JSON formats for adding recipe via API #2264
-
(edit: looks like the code formatting for logs/json doesn't work out very well. I'm open to suggestions to make it more readable) But now, If I copy/paste this into mealie itself via the JSON editor, then everything looks fine in the GUI. But the GUI also displays a warning of "No Entry Found". If I go back to the recipe after saving, then it suddenly becomes the default "empty" recipe template. My overall question: What in the json scheme is optional vs required on initial recipe post? For example, the image can't be on the filesystem when the JSON is first sent, but should the entry by there? Can recipeIngredient hashes/ids be generated automatically if missing from the text? A tail of the docker log is:
If I try to use the API to send this JSON, then things get even weirder. The request is accepted normally with response 201 and the slug as the response string. A recipe is created with the intended title for the recipe with the right title and slug. But the recipe itself is the default newly created empty recipe. The offending JSON |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Be sure to check out the API docs at When you create the recipe, you only supply the name. To edit everything else you do a |
Beta Was this translation helpful? Give feedback.
Be sure to check out the API docs at
https://your-url.com/docs
(if you're using the omni image this is currently bugged, you need to navigate to your backend url which ishttps://your-ip-address:9000/docs
)When you create the recipe, you only supply the name. To edit everything else you do a
PUT
(replace all) orPATCH
(replace some) request. The reason thePOST
returns just the slug (as a raw string) is because you need it for the subsequent update request.