You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The recipe API uses a two-step sync pattern: a lightweight list endpoint returns `{uid, hash}` pairs for change detection, and individual recipe details must be fetched one at a time.
1. Data must be gzip-compressed JSON of the **full recipe object** (not partial)
404
+
2. Send as `multipart/form-data` with field name `data`
405
+
3. Client must generate UUID4 (uppercase) for new recipes
406
+
4. Must include ALL fields — empty strings for unused text fields, `false` for booleans, `0` for rating, `[]` for categories
407
+
5. Update the `hash` field whenever recipe content changes (any 64-char hex string works)
408
+
6. Do **NOT** use the bulk endpoint (`POST /v2/sync/recipes/`) for creating recipes — it returns 500 errors. Use the individual `/sync/recipe/{uid}/` endpoint instead
409
+
410
+
#### Delete Recipe (Soft Delete Only)
411
+
**Method:** Set `in_trash: true` on the recipe object and POST the update.
412
+
413
+
```http
414
+
POST /v2/sync/recipe/{uid}/
415
+
Authorization: Bearer <token>
416
+
Content-Type: multipart/form-data
417
+
418
+
data: <gzip-compressed JSON with in_trash=true>
419
+
```
420
+
421
+
**Note:** No true DELETE endpoint exists for recipes.
422
+
423
+
#### Recommended Sync Workflow
424
+
425
+
1.**GET `/v2/sync/recipes/`** → get list of `{uid, hash}` pairs
426
+
2.**Compare hashes** against locally cached values
427
+
3.**GET `/v2/sync/recipe/{uid}/`** for each recipe with a changed or new hash
428
+
4.**Cache** the full recipe data and hash locally for future comparison
429
+
430
+
This two-step approach minimizes bandwidth — most syncs only need the lightweight list, and full recipe data is only fetched when changes are detected.
431
+
432
+
---
433
+
434
+
### Sync Status
435
+
436
+
#### Get Sync Status
437
+
**Request:**
438
+
```http
439
+
GET /v2/sync/status/
440
+
Authorization: Bearer <token>
441
+
```
442
+
443
+
**Response:**
444
+
```json
445
+
{
446
+
"result": {
447
+
"recipes": 42,
448
+
"categories": 5,
449
+
"meals": 12,
450
+
"groceries": 8,
451
+
"groceryaisles": 15,
452
+
"groceryingredients": 30,
453
+
"grocerylists": 3,
454
+
"mealtypes": 4,
455
+
"menuitems": 0,
456
+
"menus": 0,
457
+
"pantry": 10,
458
+
"photos": 25,
459
+
"bookmarks": 2
460
+
}
461
+
}
462
+
```
463
+
464
+
**Key Points:**
465
+
- Values are **change counters** that increment on modifications, not total counts
466
+
- Useful for smart syncing: only fetch a resource type if its counter has changed since last check
467
+
- Compare against previously stored values to detect which types need re-syncing
468
+
469
+
---
470
+
471
+
### Categories
472
+
473
+
#### List All Categories
474
+
**Request:**
475
+
```http
476
+
GET /v2/sync/categories/
477
+
Authorization: Bearer <token>
478
+
```
479
+
480
+
**Response:**
481
+
```json
482
+
{
483
+
"result": [
484
+
{
485
+
"uid": "CAT-UID-1",
486
+
"name": "Breakfast",
487
+
"order_flag": 0,
488
+
"parent_uid": null
489
+
},
490
+
{
491
+
"uid": "CAT-UID-2",
492
+
"name": "Baking",
493
+
"order_flag": 1,
494
+
"parent_uid": null
495
+
}
496
+
]
497
+
}
498
+
```
499
+
500
+
**Note:** Recipe `categories` field contains category names (strings), not UIDs.
0 commit comments