@@ -82,11 +82,11 @@ GET /api/collection/users
82
82
{
83
83
"data" : [
84
84
{
85
- "id" : 1 ,
85
+ "id" : " 2c4e6a8b-0d1f-4357-9ace-bdf024681357 " ,
86
86
"name" : " Lara"
87
87
},
88
88
{
89
- "id" : 2 ,
89
+ "id" : " e4d5c6b7-a890-4123-9876-543210fedcba " ,
90
90
"name" : " Karl"
91
91
}
92
92
],
@@ -142,11 +142,11 @@ Order your list by a defined property. By default the results are ordered by `id
142
142
// Output: {
143
143
// "data": [
144
144
// {
145
- // "id": 1 ,
145
+ // "id": 'e4d5c6b7-a890-4123-9876-543210fedcba' ,
146
146
// "name": "Lara"
147
147
// },
148
148
// {
149
- // "id": 2 ,
149
+ // "id": '2c4e6a8b-0d1f-4357-9ace-bdf024681357' ,
150
150
// "name": "Karl"
151
151
// }
152
152
// ],
@@ -214,7 +214,7 @@ This operation will fetch a single item based on its ID.
214
214
** Request URL** : ` GET /api/collections/:slug/:id `
215
215
216
216
```http title="Example HTTP Request"
217
- GET /api/collections/cats/34
217
+ GET /api/collections/cats/2c4e6a8b-0d1f-4357-9ace-bdf024681357
218
218
```
219
219
220
220
```json title="Example HTTP Response"
@@ -227,8 +227,8 @@ This operation will fetch a single item based on its ID.
227
227
</TabItem >
228
228
<TabItem value =" sdk " label =" JS SDK " default >
229
229
```js title="Example SDK usage"
230
- // Get cat with ID 34
231
- const cat = await manifest.from('cats').findOneById(34 )
230
+ // Get cat with ID 2c4e6a8b-0d1f-4357-9ace-bdf024681357
231
+ const cat = await manifest.from('cats').findOneById('2c4e6a8b-0d1f-4357-9ace-bdf024681357' )
232
232
233
233
console.log(cat);
234
234
// Output: {
@@ -261,7 +261,7 @@ This operation will create a new item and store it in the database. The newly cr
261
261
262
262
```json title="Example HTTP Response"
263
263
{
264
- "id": 25 ,
264
+ "id": '6ba7b810-9dad-11d1-80b4-00c04fd430c8' ,
265
265
"name": "Pikachu",
266
266
"type": "electric",
267
267
"level": 3,
@@ -280,7 +280,7 @@ This operation will create a new item and store it in the database. The newly cr
280
280
281
281
console.log(newPokemon);
282
282
// Output: {
283
- // id: 25 ,
283
+ // id: '6ba7b810-9dad-11d1-80b4-00c04fd430c8' ,
284
284
// name: "Pikachu",
285
285
// type: "electric",
286
286
// level: 3
@@ -301,7 +301,7 @@ Unlike [partial updates](#patch-an-item), this operation will replace the whole
301
301
** Request URL** : ` PUT /api/collections/:slug/:id `
302
302
303
303
```http title="Example HTTP Request"
304
- PUT /api/collections/pokemons/25
304
+ PUT /api/collections/pokemons/6ba7b810-9dad-11d1-80b4-00c04fd430c8
305
305
Content-Type: application/json
306
306
Body:
307
307
{
@@ -314,7 +314,7 @@ Unlike [partial updates](#patch-an-item), this operation will replace the whole
314
314
315
315
```json title="Example HTTP Response"
316
316
{
317
- "id": 25 ,
317
+ "id": '6ba7b810-9dad-11d1-80b4-00c04fd430c8' ,
318
318
"name": "Raichu",
319
319
"type": "electric",
320
320
"level": 8
@@ -324,16 +324,16 @@ Unlike [partial updates](#patch-an-item), this operation will replace the whole
324
324
</TabItem >
325
325
<TabItem value =" sdk " label =" JS SDK " default >
326
326
```js title="Example SDK usage"
327
- // Updates the Pokemon item with ID 25 .
328
- const newPokemon = await manifest.from('pokemons').update(25 , {
327
+ // Updates the Pokemon item with ID a1b2c3d4-e5f6-4789-abcd-ef0123456789 .
328
+ const newPokemon = await manifest.from('pokemons').update('a1b2c3d4-e5f6-4789-abcd-ef0123456789' , {
329
329
name: "Raichu",
330
330
type: "electric",
331
331
level: 8,
332
332
})
333
333
334
334
console.log(newPokemon);
335
335
// Output: {
336
- // id: 25 ,
336
+ // id: 'a1b2c3d4-e5f6-4789-abcd-ef0123456789' ,
337
337
// name: "Raichu",
338
338
// type: "electric",
339
339
// level: 8
@@ -353,7 +353,7 @@ Unlike [fully replacement](#update-an-item), this operation will only modify the
353
353
** Request URL** : ` PATCH /api/collections/:slug/:id `
354
354
355
355
```http title="Example HTTP Request"
356
- PATCH /api/collections/pokemons/25
356
+ PATCH /api/collections/pokemons/a1b2c3d4-e5f6-4789-abcd-ef0123456789
357
357
Content-Type: application/json
358
358
Body:
359
359
{
@@ -363,7 +363,7 @@ Unlike [fully replacement](#update-an-item), this operation will only modify the
363
363
364
364
```json title="Example HTTP Response"
365
365
{
366
- "id": 25 ,
366
+ "id": 'a1b2c3d4-e5f6-4789-abcd-ef0123456789' ,
367
367
"name": "Pikachu",
368
368
"type": "electric",
369
369
"level": 5
@@ -373,14 +373,14 @@ Unlike [fully replacement](#update-an-item), this operation will only modify the
373
373
</TabItem >
374
374
<TabItem value =" sdk " label =" JS SDK " default >
375
375
```js title="Example SDK usage"
376
- // Patches the Pokemon item with ID 25 .
377
- const newPokemon = await manifest.from('pokemons').patch(25 , {
376
+ // Patches the Pokemon item with ID a1b2c3d4-e5f6-4789-abcd-ef0123456789 .
377
+ const newPokemon = await manifest.from('pokemons').patch('a1b2c3d4-e5f6-4789-abcd-ef0123456789' , {
378
378
level: 5
379
379
})
380
380
381
381
console.log(newPokemon);
382
382
// Output: {
383
- // id: 25 ,
383
+ // id: 'a1b2c3d4-e5f6-4789-abcd-ef0123456789' ,
384
384
// name: "Pikachu",
385
385
// type: "electric",
386
386
// level: 5
@@ -399,7 +399,8 @@ This operation will delete permanently an item from the database. This is an irr
399
399
** Request URL** : ` DELETE /api/collections/:slug/:id `
400
400
401
401
``` http title="Example HTTP Request"
402
- DELETE api/collections/cats/60
402
+ DELETE api/collections/cats/550e8400-e29b-41d4-a716-446655440000
403
+
403
404
```
404
405
405
406
``` json title="Example HTTP Response"
@@ -412,8 +413,9 @@ DELETE api/collections/cats/60
412
413
</TabItem >
413
414
<TabItem value =" sdk " label =" JS SDK " default >
414
415
``` js title="Example SDK usage"
415
- // Delete the cat with ID 60.
416
- const deletedCat = await manifest .from (' cats' ).delete (60 )
416
+ // Delete the cat with ID 550e8400-e29b-41d4-a716-446655440000
417
+ .
418
+ const deletedCat = await manifest .from (' cats' ).delete (' 550e8400-e29b-41d4-a716-446655440000' )
417
419
418
420
console .log (deletedCat);
419
421
// Output: {
@@ -593,11 +595,11 @@ Once the relation is loaded, you can also filter items by their relation id or p
593
595
< Tabs>
594
596
< TabItem value= " sdk" label= " JS SDK" default>
595
597
` ` ` js
596
- // Get all cats that belong to owner with id 1 .
598
+ // Get all cats that belong to owner with id 3f2504e0-4f89-11d3-9a0c-0305e82c3301 .
597
599
const cats = await manifest
598
600
.from('cats')
599
601
.with(['owner'])
600
- .where('owner.id = 1 ')
602
+ .where('owner.id = 3f2504e0-4f89-11d3-9a0c-0305e82c3301 ')
601
603
.find()
602
604
603
605
// Get all cats that have an owner with name "Jorge".
@@ -611,8 +613,8 @@ Once the relation is loaded, you can also filter items by their relation id or p
611
613
< / TabItem>
612
614
< TabItem value= " rest" label= " REST API" default>
613
615
` ` ` http
614
- // Get all cats that belong to owner with id 1 .
615
- GET http://localhost:1111/api/dynamic/cats?relations=owner&owner.id_eq=1
616
+ // Get all cats that belong to owner with id 3f2504e0-4f89-11d3-9a0c-0305e82c3301 .
617
+ GET http://localhost:1111/api/dynamic/cats?relations=owner&owner.id_eq=3f2504e0-4f89-11d3-9a0c-0305e82c3301
616
618
617
619
// Get all cats that have an owner with name "Jorge".
618
620
GET http://localhost:1111/api/dynamic/cats?relations=owner&owner.name_eq=Jorge
@@ -634,8 +636,8 @@ To store or update an item with its relations, you have to pass the relation id(
634
636
Content-Type: application/json
635
637
{
636
638
"name": "Mike",
637
- "teamId": 10 ,
638
- "skillIds": [1,2,3,4,5 ]
639
+ "teamId": 'e4d5c6b7-a890-4123-9876-543210fedcba' ,
640
+ "skillIds": ['12345678-1234-5678-9abc-123456789012', '3f2504e0-4f89-11d3-9a0c-0305e82c3301' ]
639
641
}
640
642
` ` `
641
643
@@ -645,8 +647,8 @@ To store or update an item with its relations, you have to pass the relation id(
645
647
// Store a new player with relations Team and Skill.
646
648
const newPlayer = await manifest.from('players').create({
647
649
name: 'Mike',
648
- teamId: 10 ,
649
- skillIds: [1,2,3,4,5 ]
650
+ teamId: 'e4d5c6b7-a890-4123-9876-543210fedcba' ,
651
+ skillIds: ['12345678-1234-5678-9abc-123456789012', '3f2504e0-4f89-11d3-9a0c-0305e82c3301' ]
650
652
})
651
653
` ` `
652
654
@@ -667,34 +669,34 @@ As for updating properties, you can either do a **full replacement** using the u
667
669
<TabItem value="rest" label="REST API" default>
668
670
```http
669
671
// Replaces the whole skill relations by the new skillIds array.
670
- PUT http:// localhost:1111/api/dynamic/players/1
672
+ PUT http:// localhost:1111/api/dynamic/players/e4d5c6b7-a890-4123-9876-543210fedcba
671
673
Content-Type: application/json
672
674
{
673
675
name: ' Mike' ,
674
- teamId: 10 ,
675
- skillIds: [10 , 11 ]
676
+ teamId: ' e4d5c6b7-a890-4123-9876-543210fedcba ' ,
677
+ skillIds: [' 12345678-1234-5678-9abc-123456789012 ' , ' 3f2504e0-4f89-11d3-9a0c-0305e82c3301 ' ]
676
678
}
677
679
678
680
// Updates the team without changing the skills or the name.
679
- PATCH http: // localhost:1111/api/dynamic/players/1
681
+ PATCH http: // localhost:1111/api/dynamic/players/e4d5c6b7-a890-4123-9876-543210fedcba
680
682
Content- Type: application/ json
681
683
{
682
- teamId: 5 ,
684
+ teamId: ' 9b2fff23-ec93-4b48-9322-bbd4b6b5b123 ' ,
683
685
}
684
686
```
685
687
686
688
< / TabItem>
687
689
< TabItem value= " sdk" label= " JS SDK" default>
688
690
` ` ` js
689
691
// Replaces the whole skill relations by the new skillIds array.
690
- await manifest.from('players').update(1 , {
692
+ await manifest.from('players').update('e4d5c6b7-a890-4123-9876-543210fedcba' , {
691
693
name: 'Mike',
692
- teamId: 10 ,
693
- skillIds: [10, 11 ]
694
+ teamId: 'e4d5c6b7-a890-4123-9876-543210fedcba' ,
695
+ skillIds: ['12345678-1234-5678-9abc-123456789012', '3f2504e0-4f89-11d3-9a0c-0305e82c3301' ]
694
696
})
695
697
696
698
// Updates the team without changing the skills or the name.
697
- await manifest.from('players').patch(1 , {teamId: 5 })
699
+ await manifest.from('players').patch('e4d5c6b7-a890-4123-9876-543210fedcba' , {teamId: '9b2fff23-ec93-4b48-9322-bbd4b6b5b123' })
698
700
` ` `
699
701
700
702
< / TabItem>
0 commit comments