appCreateSalesOrder
Requires permission sales:sales_order:create.
Create a DRAFT sales order from an installed app. Send the customer, lines (variant, unit, quantity) and words; the server prices every line and sets tax, shipping, totals, currency, rate and dates. Needs write_orders.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation AppCreateSalesOrder($input: AppCreateSalesOrderInput!) {
appCreateSalesOrder(input: $input) {
id
customerPoNumber
orderNumber
sourceQuoteNumber
trackingNumber
creatorName
billingAddress {
postalCode
city
country
state
street1
street2
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation AppCreateSalesOrder($input: AppCreateSalesOrderInput!) {\n appCreateSalesOrder(input: $input) {\n id\n customerPoNumber\n orderNumber\n sourceQuoteNumber\n trackingNumber\n creatorName\n billingAddress {\n postalCode\n city\n country\n state\n street1\n street2\n }\n }\n}",
"variables": {
"input": {
"customerId": "id",
"lines": [
{
"quantity": 0,
"uomId": "id",
"variantId": "id"
}
]
}
}
}
EOF
Variables:
{
"input": {
"customerId": "id",
"lines": [
{
"quantity": 0,
"uomId": "id",
"variantId": "id"
}
]
}
}
Response:
{
"data": {
"appCreateSalesOrder": {
"id": "id",
"customerPoNumber": "string",
"orderNumber": "string",
"sourceQuoteNumber": "string",
"trackingNumber": "string",
"creatorName": "string",
"billingAddress": {
"postalCode": "string",
"city": "string",
"country": "string",
"state": "string",
"street1": "string",
"street2": "string"
}
}
}
}
appCreateSalesOrder(
input: AppCreateSalesOrderInput!
): SalesOrder!
Arguments
appCreateSalesOrder.input ● AppCreateSalesOrderInput! non-null input
The order.
Type
SalesOrder object
A confirmed demand from a customer to ship goods, usually converted from a quote. Moves through confirmation, shipment, invoicing and payment.