Order insertion
Order creation
Inserts a new order that appears immediately in the restaurant’s incoming orders queue.
POST
/
order
/
create
Order creation
curl --request POST \
--url https://app.xmenu.it/api/order/create \
--header 'Content-Type: application/json' \
--header 'X-Client-Id: <api-key>' \
--header 'X-Client-Secret: <api-key>' \
--data '
{
"client": {
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>"
},
"dmethod": "<string>",
"details": [
{
"product": {
"uid": "<string>"
},
"quantity": 123,
"notes": "<string>",
"options": [
{
"uid": "<string>",
"values": [
{
"uid": "<string>",
"quantity": 123
}
]
}
]
}
],
"subrestaurant_uid": "<string>",
"language": "<string>",
"payment_method_sub": "<string>",
"notes": "<string>"
}
'import requests
url = "https://app.xmenu.it/api/order/create"
payload = {
"client": {
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>"
},
"dmethod": "<string>",
"details": [
{
"product": { "uid": "<string>" },
"quantity": 123,
"notes": "<string>",
"options": [
{
"uid": "<string>",
"values": [
{
"uid": "<string>",
"quantity": 123
}
]
}
]
}
],
"subrestaurant_uid": "<string>",
"language": "<string>",
"payment_method_sub": "<string>",
"notes": "<string>"
}
headers = {
"X-Client-Id": "<api-key>",
"X-Client-Secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Client-Id': '<api-key>',
'X-Client-Secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
client: {
first_name: '<string>',
last_name: '<string>',
email: '<string>',
phone: '<string>'
},
dmethod: '<string>',
details: [
{
product: {uid: '<string>'},
quantity: 123,
notes: '<string>',
options: [{uid: '<string>', values: [{uid: '<string>', quantity: 123}]}]
}
],
subrestaurant_uid: '<string>',
language: '<string>',
payment_method_sub: '<string>',
notes: '<string>'
})
};
fetch('https://app.xmenu.it/api/order/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.xmenu.it/api/order/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'client' => [
'first_name' => '<string>',
'last_name' => '<string>',
'email' => '<string>',
'phone' => '<string>'
],
'dmethod' => '<string>',
'details' => [
[
'product' => [
'uid' => '<string>'
],
'quantity' => 123,
'notes' => '<string>',
'options' => [
[
'uid' => '<string>',
'values' => [
[
'uid' => '<string>',
'quantity' => 123
]
]
]
]
]
],
'subrestaurant_uid' => '<string>',
'language' => '<string>',
'payment_method_sub' => '<string>',
'notes' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Client-Id: <api-key>",
"X-Client-Secret: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.xmenu.it/api/order/create"
payload := strings.NewReader("{\n \"client\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\"\n },\n \"dmethod\": \"<string>\",\n \"details\": [\n {\n \"product\": {\n \"uid\": \"<string>\"\n },\n \"quantity\": 123,\n \"notes\": \"<string>\",\n \"options\": [\n {\n \"uid\": \"<string>\",\n \"values\": [\n {\n \"uid\": \"<string>\",\n \"quantity\": 123\n }\n ]\n }\n ]\n }\n ],\n \"subrestaurant_uid\": \"<string>\",\n \"language\": \"<string>\",\n \"payment_method_sub\": \"<string>\",\n \"notes\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Client-Id", "<api-key>")
req.Header.Add("X-Client-Secret", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.xmenu.it/api/order/create")
.header("X-Client-Id", "<api-key>")
.header("X-Client-Secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"client\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\"\n },\n \"dmethod\": \"<string>\",\n \"details\": [\n {\n \"product\": {\n \"uid\": \"<string>\"\n },\n \"quantity\": 123,\n \"notes\": \"<string>\",\n \"options\": [\n {\n \"uid\": \"<string>\",\n \"values\": [\n {\n \"uid\": \"<string>\",\n \"quantity\": 123\n }\n ]\n }\n ]\n }\n ],\n \"subrestaurant_uid\": \"<string>\",\n \"language\": \"<string>\",\n \"payment_method_sub\": \"<string>\",\n \"notes\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.xmenu.it/api/order/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Client-Id"] = '<api-key>'
request["X-Client-Secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"client\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\"\n },\n \"dmethod\": \"<string>\",\n \"details\": [\n {\n \"product\": {\n \"uid\": \"<string>\"\n },\n \"quantity\": 123,\n \"notes\": \"<string>\",\n \"options\": [\n {\n \"uid\": \"<string>\",\n \"values\": [\n {\n \"uid\": \"<string>\",\n \"quantity\": 123\n }\n ]\n }\n ]\n }\n ],\n \"subrestaurant_uid\": \"<string>\",\n \"language\": \"<string>\",\n \"payment_method_sub\": \"<string>\",\n \"notes\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"error": "<string>",
"message": "<string>",
"order": {
"uid": "<string>",
"token": "<string>",
"order_number": "<string>",
"total": 123,
"date": "2023-11-07T05:31:56Z",
"confirmed": true,
"delivery_fee": 123,
"pickup_date": "2023-11-07T05:31:56Z",
"delivery_date": "2023-11-07T05:31:56Z",
"coupon": {
"code": "<string>",
"description": "<string>",
"discount": 123,
"auto": true
}
}
}write:ordersAuthorizations
clientId & clientSecretoauth2
Body
application/json
Response
Order creation response
Error code if the operation failed. Possible values:
VALIDATION_ERROR= the request data did not pass validation (missing or malformed parameters, chosen pickup/delivery time no longer available, location closed, minimum order amount not reached, ...) - see themessagefield for detailsPRODUCT_NOT_FOUND= product not foundPRODUCT_NOT_AVAILABLE= product unavailablePRODUCT_ERROR= error while adding the product to the order - see themessagefield for detailsOPTION_VALUE_NOT_FOUND= option value not foundINVALID_ADDRESS= invalid, incomplete or not found addressADDRESS_NOT_SERVED= address outside service zoneDELIVERY_NOT_AVAILABLE= delivery service unavailableEXTERNAL_SERVICE_ERROR= the geocoding/distance external service is temporarily unavailableCOUPON_ERROR= coupon application errorSUBRESTAURANT_NOT_FOUND= location not foundMGMTSW_ERROR= the order was rejected by the management software integrated with the locationPONYSERVICE_ERROR= the order was rejected by the courier provider (address or time slot not serviceable)ORDER_ERROR= the order could not be submitted to the location
See Error codes for general error codes that may also occur.
⌘I
Order creation
curl --request POST \
--url https://app.xmenu.it/api/order/create \
--header 'Content-Type: application/json' \
--header 'X-Client-Id: <api-key>' \
--header 'X-Client-Secret: <api-key>' \
--data '
{
"client": {
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>"
},
"dmethod": "<string>",
"details": [
{
"product": {
"uid": "<string>"
},
"quantity": 123,
"notes": "<string>",
"options": [
{
"uid": "<string>",
"values": [
{
"uid": "<string>",
"quantity": 123
}
]
}
]
}
],
"subrestaurant_uid": "<string>",
"language": "<string>",
"payment_method_sub": "<string>",
"notes": "<string>"
}
'import requests
url = "https://app.xmenu.it/api/order/create"
payload = {
"client": {
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>"
},
"dmethod": "<string>",
"details": [
{
"product": { "uid": "<string>" },
"quantity": 123,
"notes": "<string>",
"options": [
{
"uid": "<string>",
"values": [
{
"uid": "<string>",
"quantity": 123
}
]
}
]
}
],
"subrestaurant_uid": "<string>",
"language": "<string>",
"payment_method_sub": "<string>",
"notes": "<string>"
}
headers = {
"X-Client-Id": "<api-key>",
"X-Client-Secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Client-Id': '<api-key>',
'X-Client-Secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
client: {
first_name: '<string>',
last_name: '<string>',
email: '<string>',
phone: '<string>'
},
dmethod: '<string>',
details: [
{
product: {uid: '<string>'},
quantity: 123,
notes: '<string>',
options: [{uid: '<string>', values: [{uid: '<string>', quantity: 123}]}]
}
],
subrestaurant_uid: '<string>',
language: '<string>',
payment_method_sub: '<string>',
notes: '<string>'
})
};
fetch('https://app.xmenu.it/api/order/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.xmenu.it/api/order/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'client' => [
'first_name' => '<string>',
'last_name' => '<string>',
'email' => '<string>',
'phone' => '<string>'
],
'dmethod' => '<string>',
'details' => [
[
'product' => [
'uid' => '<string>'
],
'quantity' => 123,
'notes' => '<string>',
'options' => [
[
'uid' => '<string>',
'values' => [
[
'uid' => '<string>',
'quantity' => 123
]
]
]
]
]
],
'subrestaurant_uid' => '<string>',
'language' => '<string>',
'payment_method_sub' => '<string>',
'notes' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Client-Id: <api-key>",
"X-Client-Secret: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.xmenu.it/api/order/create"
payload := strings.NewReader("{\n \"client\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\"\n },\n \"dmethod\": \"<string>\",\n \"details\": [\n {\n \"product\": {\n \"uid\": \"<string>\"\n },\n \"quantity\": 123,\n \"notes\": \"<string>\",\n \"options\": [\n {\n \"uid\": \"<string>\",\n \"values\": [\n {\n \"uid\": \"<string>\",\n \"quantity\": 123\n }\n ]\n }\n ]\n }\n ],\n \"subrestaurant_uid\": \"<string>\",\n \"language\": \"<string>\",\n \"payment_method_sub\": \"<string>\",\n \"notes\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Client-Id", "<api-key>")
req.Header.Add("X-Client-Secret", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.xmenu.it/api/order/create")
.header("X-Client-Id", "<api-key>")
.header("X-Client-Secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"client\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\"\n },\n \"dmethod\": \"<string>\",\n \"details\": [\n {\n \"product\": {\n \"uid\": \"<string>\"\n },\n \"quantity\": 123,\n \"notes\": \"<string>\",\n \"options\": [\n {\n \"uid\": \"<string>\",\n \"values\": [\n {\n \"uid\": \"<string>\",\n \"quantity\": 123\n }\n ]\n }\n ]\n }\n ],\n \"subrestaurant_uid\": \"<string>\",\n \"language\": \"<string>\",\n \"payment_method_sub\": \"<string>\",\n \"notes\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.xmenu.it/api/order/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Client-Id"] = '<api-key>'
request["X-Client-Secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"client\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\"\n },\n \"dmethod\": \"<string>\",\n \"details\": [\n {\n \"product\": {\n \"uid\": \"<string>\"\n },\n \"quantity\": 123,\n \"notes\": \"<string>\",\n \"options\": [\n {\n \"uid\": \"<string>\",\n \"values\": [\n {\n \"uid\": \"<string>\",\n \"quantity\": 123\n }\n ]\n }\n ]\n }\n ],\n \"subrestaurant_uid\": \"<string>\",\n \"language\": \"<string>\",\n \"payment_method_sub\": \"<string>\",\n \"notes\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"error": "<string>",
"message": "<string>",
"order": {
"uid": "<string>",
"token": "<string>",
"order_number": "<string>",
"total": 123,
"date": "2023-11-07T05:31:56Z",
"confirmed": true,
"delivery_fee": 123,
"pickup_date": "2023-11-07T05:31:56Z",
"delivery_date": "2023-11-07T05:31:56Z",
"coupon": {
"code": "<string>",
"description": "<string>",
"discount": 123,
"auto": true
}
}
}