createWarehouse
Requires permission inventory:warehouse:create.
Creates a warehouse. The code must not already be used by another warehouse of the organization. A new warehouse is active. Needs the warehouse create permission.
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 CreateWarehouse($input: CreateWarehouseInput!) {
createWarehouse(input: $input) {
id
code
taxRegistrationNumber
name
status
type
address {
postalCode
city
country
latitude
longitude
state
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation CreateWarehouse($input: CreateWarehouseInput!) {\n createWarehouse(input: $input) {\n id\n code\n taxRegistrationNumber\n name\n status\n type\n address {\n postalCode\n city\n country\n latitude\n longitude\n state\n }\n }\n}",
"variables": {
"input": {
"code": "string",
"name": "string",
"type": "string"
}
}
}
EOF
Variables:
{
"input": {
"code": "string",
"name": "string",
"type": "string"
}
}
Response:
{
"data": {
"createWarehouse": {
"id": "id",
"code": "string",
"taxRegistrationNumber": "string",
"name": "string",
"status": "ACTIVE",
"type": "string",
"address": {
"postalCode": "string",
"city": "string",
"country": "string",
"latitude": 0,
"longitude": 0,
"state": "string"
}
}
}
}
createWarehouse(
input: CreateWarehouseInput!
): Warehouse!
Arguments
createWarehouse.input ● CreateWarehouseInput! non-null input
The warehouse's name, code and details.
Type
Warehouse object
A location where stock is held.