bulkImportPurchaseOrders
Requires permission purchase:purchase_order:create.
Imports purchase orders from a CSV or Excel file, grouping rows into orders by order number. Each order needs a supplier, an order date in YYYY-MM-DD form, and lines with a product or variant identifier and a quantity above 0. The result reports what was created and what failed. Needs the purchase order create permission and the purchase orders feature on your plan.
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 BulkImportPurchaseOrders($input: BulkImportInput!) {
bulkImportPurchaseOrders(input: $input) {
failed
success
errors {
orderNumber
errors
row
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation BulkImportPurchaseOrders($input: BulkImportInput!) {\n bulkImportPurchaseOrders(input: $input) {\n failed\n success\n errors {\n orderNumber\n errors\n row\n }\n }\n}",
"variables": {
"input": {
"fileContent": "string",
"format": "CSV"
}
}
}
EOF
Variables:
{
"input": {
"fileContent": "string",
"format": "CSV"
}
}
Response:
{
"data": {
"bulkImportPurchaseOrders": {
"failed": 0,
"success": 0,
"errors": [
{
"orderNumber": "string",
"errors": [
"string"
],
"row": 0
}
]
}
}
}
bulkImportPurchaseOrders(
input: BulkImportInput!
): PurchaseOrderBulkImportResult!
Arguments
bulkImportPurchaseOrders.input ● BulkImportInput! non-null input
The details of the bulk import request.
Type
PurchaseOrderBulkImportResult object
Result of a bulk purchase order import.