Skip to content

Instantly share code, notes, and snippets.

@ruvaleev
Created January 3, 2022 11:43
Show Gist options
  • Save ruvaleev/9af42d61d05e23d202160f1c9f8674a3 to your computer and use it in GitHub Desktop.
Save ruvaleev/9af42d61d05e23d202160f1c9f8674a3 to your computer and use it in GitHub Desktop.
Создание рецепта
curl -X 'POST' \
'https://murmuring-forest-17162.herokuapp.com/receipts' \
-H 'accept: application/json' \
-H 'Authorization: 7b89ff5a9f267d457a2b239f282f3fbf6da9dabfdad7b8ae16598579f8dcd616' \
-H 'Content-Type: application/json' \
-d '{
"receipt": {
"description": "Описание рецепта",
"portions_count": 4,
"cooking_duration": 30,
"meals_attributes": [
{
"title": "Селедка под шубой",
"description": "Описание блюда",
"meal_kind_id": "d85ce0d1-4bda-4fc4-a514-63b23373dd9d"
}
],
"receipt_steps_attributes": [
{
"description": "Берем селедку (а на самом деле апельсин)",
"number": 0
},
{
"description": "Берем шубу (а на самом деле тоже морковь)",
"number": 1
},
{
"description": "Получилась селедка под шубой, приятного аппетита!",
"number": 2
}
],
"receipts_ingredients_attributes": [
{
"ingredient_id": "7f70ccde-db98-412d-8f29-5720c1d5271d",
"grams": 100
},
{
"ingredient_id": "3c75a93f-3863-4329-97b5-ec39aad8e4a4",
"grams": 200
}
],
"receipts_cooking_methods_attributes": [
{
"cooking_method_id": "a25d3a05-9e4c-49ec-94f2-18f2d57b9ef4"
}
]
}
}'
{
"id": "2f9779a2-b903-4f20-abad-955f85211812",
"created_at": "2022-01-03T11:42:44.400Z",
"updated_at": "2022-01-03T11:42:44.400Z",
"description": "Описание рецепта",
"calories_per_portion": 0,
"carbohydrates_per_portion": 0,
"cooking_duration": 30,
"fat_per_portion": 0,
"portions_count": 4,
"protein_per_portion": 0,
"receipt_steps_count": 3,
"meals": [
{
"id": "8f6fb892-1642-4571-90f7-4e3eb1aa279f",
"created_at": "2022-01-03T11:42:44.410Z",
"updated_at": "2022-01-03T11:42:44.410Z",
"title": "Селедка под шубой",
"description": "Описание блюда",
"calories": 0,
"meal_kind": {
"id": "d85ce0d1-4bda-4fc4-a514-63b23373dd9d",
"created_at": "2021-12-28T13:57:50.451Z",
"updated_at": "2021-12-28T13:57:50.451Z",
"title": "salad"
}
}
],
"receipt_steps": [
{
"id": "97f4ce0d-41e0-4112-9502-054e94bb9959",
"created_at": "2022-01-03T11:42:44.417Z",
"updated_at": "2022-01-03T11:42:44.417Z",
"description": "Берем селедку (а на самом деле апельсин)",
"number": 0
},
{
"id": "c2d84c18-9726-4820-9671-916c83296f4c",
"created_at": "2022-01-03T11:42:44.425Z",
"updated_at": "2022-01-03T11:42:44.425Z",
"description": "Берем шубу (а на самом деле тоже морковь)",
"number": 1
},
{
"id": "51c96399-295f-435c-9625-f92e97f4e33d",
"created_at": "2022-01-03T11:42:44.428Z",
"updated_at": "2022-01-03T11:42:44.428Z",
"description": "Получилась селедка под шубой, приятного аппетита!",
"number": 2
}
],
"receipts_ingredients": [
{
"id": "91cd616d-d7e1-4432-9a54-ef91ee5158ff",
"created_at": "2022-01-03T11:42:44.437Z",
"updated_at": "2022-01-03T11:42:44.437Z",
"ingredient": {
"id": "7f70ccde-db98-412d-8f29-5720c1d5271d",
"created_at": "2021-12-28T13:57:50.287Z",
"updated_at": "2021-12-28T13:57:50.287Z",
"title": "Апельсин",
"calories": 43,
"protein": 1,
"fat": 0,
"carbohydrates": 8,
"custom_unit_name": null,
"custom_unit_equivalent_in_standard_units": null,
"standard_unit": "gram"
},
"grams": 100
},
{
"id": "69919e7f-f121-47af-9875-95f39c11a0a3",
"created_at": "2022-01-03T11:42:44.440Z",
"updated_at": "2022-01-03T11:42:44.440Z",
"ingredient": {
"id": "3c75a93f-3863-4329-97b5-ec39aad8e4a4",
"created_at": "2021-12-28T13:57:50.330Z",
"updated_at": "2021-12-28T13:57:50.330Z",
"title": "Морковь",
"calories": 35,
"protein": 1,
"fat": 0,
"carbohydrates": 7,
"custom_unit_name": null,
"custom_unit_equivalent_in_standard_units": null,
"standard_unit": "gram"
},
"grams": 200
}
],
"cooking_methods": [
{
"id": "a25d3a05-9e4c-49ec-94f2-18f2d57b9ef4",
"created_at": "2021-12-28T13:57:50.109Z",
"updated_at": "2021-12-28T13:57:50.109Z",
"title": "На пару"
}
],
"author": {
"id": "1719cd6d-8cd4-4c49-81a7-f4260cea1163",
"created_at": "2021-12-29T09:00:35.286Z",
"updated_at": "2021-12-29T09:00:35.286Z",
"name": "heyyiii",
"email": "qq@gmail.com",
"gender": "male",
"age": 25,
"height": null,
"current_weight": null,
"goal_weight": null,
"goal_daily_calories": 1800,
"activity": "low",
"active_preference": null
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment