Setting up an API call with child objects
Options
Jose Pozuelo
Member ✭
Hi Everyone! I am pretty new to Xano, and I am trying to integrate a couple of different restaurant ordering systems to have all the data in one place and create some internal tools.
One thing that I still don´t know how to approach are the modifications to the automated API endpoints. I would like to create an endpoint where to POST an Order, you have to also include the Products associated with the Order, and the modifiers associated with each product.
Example of the data structure:
{
"count": 1,
"orders": [
{
"instructions": "",
"coupons": [],
"tax_list": [],
"missed_reason": null,
"billing_details": null,
"fulfillment_option": null,
"id": 200152932,
"total_price": 7000,
"sub_total_price": 7000,
"tax_value": 0,
"persons": 0,
"latitude": "9.859516015638729",
"longitude": "-83.92034103847655",
"client_first_name": "Prueba",
"client_last_name": "Prueba",
"client_email": "jose@stripzchicken.com",
"client_phone": "+50686176848",
"restaurant_name": "Stripz",
"currency": "CRC",
"type": "pickup",
"status": "accepted",
"source": "admin",
"pin_skipped": false,
"accepted_at": "2020-12-10T22:48:12.000Z",
"tax_type": "NET",
"tax_name": "Sales Tax",
"fulfill_at": "2020-12-10T23:03:12.000Z",
"reference": null,
"restaurant_id": 210093,
"client_id": 12763649,
"updated_at": "2020-12-10T22:48:12.000Z",
"restaurant_phone": "+506 6243 5870",
"restaurant_timezone": "America/Costa_Rica",
"company_account_id": 878350,
"pos_system_id": 22017,
"restaurant_key": "mBvryF5xquMZz6r1p",
"restaurant_country": "Costa Rica",
"restaurant_city": "San José",
"restaurant_zipcode": null,
"restaurant_street": "300m sur de la iglesia de guadalupe",
"restaurant_latitude": "9.944473727180936",
"restaurant_longitude": "-84.05159977452162",
"client_marketing_consent": true,
"restaurant_token": "320",
"gateway_transaction_id": null,
"gateway_type": null,
"api_version": 2,
"payment": "SINPE Móvil",
"for_later": false,
"client_address": null,
"client_address_parts": null,
"items": [
{
"id": 266775948,
"name": "3 Stripz",
"total_item_price": 7000,
"price": 3500,
"quantity": 2,
"instructions": "",
"type": "item",
"type_id": 6132528,
"tax_rate": 0,
"tax_value": 0,
"parent_id": null,
"item_discount": 0,
"cart_discount_rate": 0,
"cart_discount": 0,
"tax_type": "NET",
"options": [
{
"id": 255432791,
"name": "Rosada pimienta",
"price": 0,
"group_name": "Elegí 1 salsa",
"quantity": 1,
"type": "option",
"type_id": 6099299
}
]
}
]
}
]
}
One thing that I still don´t know how to approach are the modifications to the automated API endpoints. I would like to create an endpoint where to POST an Order, you have to also include the Products associated with the Order, and the modifiers associated with each product.
Example of the data structure:
{
"count": 1,
"orders": [
{
"instructions": "",
"coupons": [],
"tax_list": [],
"missed_reason": null,
"billing_details": null,
"fulfillment_option": null,
"id": 200152932,
"total_price": 7000,
"sub_total_price": 7000,
"tax_value": 0,
"persons": 0,
"latitude": "9.859516015638729",
"longitude": "-83.92034103847655",
"client_first_name": "Prueba",
"client_last_name": "Prueba",
"client_email": "jose@stripzchicken.com",
"client_phone": "+50686176848",
"restaurant_name": "Stripz",
"currency": "CRC",
"type": "pickup",
"status": "accepted",
"source": "admin",
"pin_skipped": false,
"accepted_at": "2020-12-10T22:48:12.000Z",
"tax_type": "NET",
"tax_name": "Sales Tax",
"fulfill_at": "2020-12-10T23:03:12.000Z",
"reference": null,
"restaurant_id": 210093,
"client_id": 12763649,
"updated_at": "2020-12-10T22:48:12.000Z",
"restaurant_phone": "+506 6243 5870",
"restaurant_timezone": "America/Costa_Rica",
"company_account_id": 878350,
"pos_system_id": 22017,
"restaurant_key": "mBvryF5xquMZz6r1p",
"restaurant_country": "Costa Rica",
"restaurant_city": "San José",
"restaurant_zipcode": null,
"restaurant_street": "300m sur de la iglesia de guadalupe",
"restaurant_latitude": "9.944473727180936",
"restaurant_longitude": "-84.05159977452162",
"client_marketing_consent": true,
"restaurant_token": "320",
"gateway_transaction_id": null,
"gateway_type": null,
"api_version": 2,
"payment": "SINPE Móvil",
"for_later": false,
"client_address": null,
"client_address_parts": null,
"items": [
{
"id": 266775948,
"name": "3 Stripz",
"total_item_price": 7000,
"price": 3500,
"quantity": 2,
"instructions": "",
"type": "item",
"type_id": 6132528,
"tax_rate": 0,
"tax_value": 0,
"parent_id": null,
"item_discount": 0,
"cart_discount_rate": 0,
"cart_discount": 0,
"tax_type": "NET",
"options": [
{
"id": 255432791,
"name": "Rosada pimienta",
"price": 0,
"group_name": "Elegí 1 salsa",
"quantity": 1,
"type": "option",
"type_id": 6099299
}
]
}
]
}
]
}
Comments
-
would really appreciate you can point me towards a learning resource that might help me achieve this!
-
Hi you can accomplish this with Addons!
-
Thanks! worked perfectly
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback