ATUM REST API

Product locations

ATUM

The ATUM product locations API allows you to create, view, update, and delete individual, or a batch, of locations.

The product locations endpoints are only available when the ATUM Purchase Orders module is enabled. Reading the locations requires the ATUM manage_location_terms capability, creating or editing them requires edit_location_terms and deleting them requires delete_location_terms.

Product location properties

AttributeTypeDescription
idintegerUnique identifier for the resource. read-only
namestringLocation name. mandatory
slugstringAn alphanumeric identifier for the resource unique to its type.
parentintegerThe ID for the parent of the resource.
descriptionstringHTML description of the resource.
countintegerNumber of published products for the resource. read-only
barcodestringThe barcode used for all the products linked to this location. Only present when the ATUM Barcodes module is enabled and the user has the view_barcode capability (the edit_barcode capability is required to change it). ATUM

Create a product location

This API helps you to create a new product location.

HTTP request

POST/wp-json/wc/v3/products/atum-locations

Example of how to create a product location

curl -X POST https://example.com/wp-json/wc/v3/products/atum-locations \
	-u consumer_key:consumer_secret \
	-H "Content-Type: application/json" \
	-d '{
  "name": "Manchester",
  "parent": 38
}'
JSON response example
{
    "id": 58,
    "name": "Manchester",
    "slug": "manchester",
    "parent": 38,
    "description": "",
    "count": 0,
    "barcode": "",
    "_links": {
        "self": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/atum-locations/58"
            }
        ],
        "collection": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/atum-locations"
            }
        ],
        "up": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/atum-locations/38"
            }
        ]
    }
}

Retrieve a product location

This API lets you retrieve a product location by ID.

GET/wp-json/wc/v3/products/atum-locations/<id>
curl https://example.com/wp-json/wc/v3/products/atum-locations/38 \
	-u consumer_key:consumer_secret
JSON response example
{
    "id": 38,
    "name": "United Kingdom",
    "slug": "united-kingdom",
    "parent": 0,
    "description": "",
    "count": 7,
    "barcode": "",
    "_links": {
        "self": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/atum-locations/38"
            }
        ],
        "collection": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/atum-locations"
            }
        ]
    }
}

List all product locations

This API lets you retrieve all product locations.

GET/wp-json/wc/v3/products/atum-locations
curl https://example.com/wp-json/wc/v3/products/atum-locations \
	-u consumer_key:consumer_secret
JSON response example
[
    {
        "id": 39,
        "name": "Italy",
        "slug": "italy",
        "parent": 0,
        "description": "",
        "count": 5,
        "barcode": "",
        "_links": {
            "self": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/atum-locations/39"
                }
            ],
            "collection": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/atum-locations"
                }
            ]
        }
    },
    {
        "id": 50,
        "name": "Madrid",
        "slug": "madrid",
        "parent": 37,
        "description": "",
        "count": 3,
        "barcode": "",
        "_links": {
            "self": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/atum-locations/50"
                }
            ],
            "collection": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/atum-locations"
                }
            ],
            "up": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/atum-locations/37"
                }
            ]
        }
    },
    {
        "id": 58,
        "name": "Manchester",
        "slug": "manchester",
        "parent": 38,
        "description": "",
        "count": 0,
        "barcode": "",
        "_links": {
            "self": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/atum-locations/58"
                }
            ],
            "collection": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/atum-locations"
                }
            ],
            "up": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/atum-locations/38"
                }
            ]
        }
    },
    {
        "id": 53,
        "name": "Slovakia",
        "slug": "slovakia",
        "parent": 0,
        "description": "",
        "count": 0,
        "barcode": "",
        "_links": {
            "self": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/atum-locations/53"
                }
            ],
            "collection": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/atum-locations"
                }
            ]
        }
    },
    {
        "id": 37,
        "name": "Spain",
        "slug": "spain",
        "parent": 0,
        "description": "",
        "count": 7,
        "barcode": "",
        "_links": {
            "self": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/atum-locations/37"
                }
            ],
            "collection": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/atum-locations"
                }
            ]
        }
    },
    {
        "id": 38,
        "name": "United Kingdom",
        "slug": "united-kingdom",
        "parent": 0,
        "description": "",
        "count": 7,
        "barcode": "UIOHOUIGHOUO",
        "_links": {
            "self": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/atum-locations/38"
                }
            ],
            "collection": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/atum-locations"
                }
            ]
        }
    },
    {
        "id": 49,
        "name": "Valencia",
        "slug": "valencia",
        "parent": 37,
        "description": "",
        "count": 6,
        "barcode": "",
        "_links": {
            "self": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/atum-locations/49"
                }
            ],
            "collection": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/atum-locations"
                }
            ],
            "up": [
                {
                    "href": "https://example.com/wp-json/wc/v3/products/atum-locations/37"
                }
            ]
        }
    }
]

Available parameters

ParameterTypeDescription
contextstringScope under which the request is made; determines fields present in response. Options: view and edit. Default is view.
pageintegerCurrent page of the collection. Default is 1.
per_pageintegerMaximum number of items to be returned in result set. Default is 10. Maximum is 100.
searchstringLimit results to those matching a string.
excludearrayEnsure result set excludes specific ids.
includearrayLimit result set to specific ids.
offsetintegerOffset the result set by a specific number of items.
orderstringOrder sort attribute ascending or descending. Options: asc and desc. Default is asc.
orderbystringSort collection by resource attribute. Options: id, include, name, slug, term_group, description and count. Default is name.
hide_emptybooleanWhether to hide resources not assigned to any products. Default is false.
parentintegerLimit result set to resources assigned to a specific parent.
productintegerLimit result set to resources assigned to a specific product.
slugstring, arrayLimit result set to resources with a specific slug (or any of the specified slugs).

Update a product location

This API lets you make changes to a product location.

HTTP request

PUT/wp-json/wc/v3/products/atum-locations/<id>
curl -X PUT https://example.com/wp-json/wc/v3/products/atum-locations/58 \
	-u consumer_key:consumer_secret \
	-H "Content-Type: application/json" \
	-d '{
  "description": "Manchester city."
}'
JSON response example
{
    "id": 58,
    "name": "Manchester",
    "slug": "manchester",
    "parent": 38,
    "description": "Manchester city.",
    "count": 0,
    "barcode": "",
    "_links": {
        "self": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/atum-locations/58"
            }
        ],
        "collection": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/atum-locations"
            }
        ],
        "up": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/atum-locations/38"
            }
        ]
    }
}

Delete a product location

This API helps you delete a product location.

HTTP request

DELETE/wp-json/wc/v3/products/atum-locations/<id>
curl -X DELETE https://example.com/wp-json/wc/v3/products/atum-locations/58?force=true \
	-u consumer_key:consumer_secret
JSON response example
{
    "id": 58,
    "name": "Manchester",
    "slug": "manchester",
    "parent": 38,
    "description": "Manchester city.",
    "count": 0,
    "barcode": "",
    "_links": {
        "self": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/atum-locations/58"
            }
        ],
        "collection": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/atum-locations"
            }
        ],
        "up": [
            {
                "href": "https://example.com/wp-json/wc/v3/products/atum-locations/38"
            }
        ]
    }
}

Available parameters

ParameterTypeDescription
forcebooleanRequired to be true, as resource does not support trashing.

Batch update product locations

This API helps you to batch create, update and delete multiple product locations.

Note: By default it's limited to up to 100 objects to be created, updated or deleted.

HTTP request

POST/wp-json/wc/v3/products/atum-locations/batch
curl -X POST https://example.com//wp-json/wc/v3/products/atum-locations/batch \
	-u consumer_key:consumer_secret \
	-H "Content-Type: application/json" \
	-d '{
    "create": [
        {
          "name": "London",
          "parent": 38
        },
        {
          "name": "Portugal"
        }
    ],
    "update": [
        {
            "id": 49,
            "description": "Valencia city."
        }	
    ],
    "delete": [
        59	
    ]
}'
JSON response example
{
    "create": [
        {
            "id": 60,
            "name": "London",
            "slug": "london",
            "parent": 38,
            "description": "",
            "count": 0,
            "barcode": "",
            "_links": {
                "self": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/atum-locations/60"
                    }
                ],
                "collection": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/atum-locations"
                    }
                ],
                "up": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/atum-locations/38"
                    }
                ]
            }
        },
        {
            "id": 61,
            "name": "Portugal",
            "slug": "portugal",
            "parent": 0,
            "description": "",
            "count": 0,
            "barcode": "",
            "_links": {
                "self": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/atum-locations/61"
                    }
                ],
                "collection": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/atum-locations"
                    }
                ]
            }
        }
    ],
    "update": [
        {
            "id": 49,
            "name": "Valencia",
            "slug": "valencia",
            "parent": 37,
            "description": "Valencia city.",
            "count": 6,
            "barcode": "",
            "_links": {
                "self": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/atum-locations/49"
                    }
                ],
                "collection": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/atum-locations"
                    }
                ],
                "up": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/atum-locations/37"
                    }
                ]
            }
        }
    ],
    "delete": [
        {
            "id": 59,
            "name": "Manchester",
            "slug": "manchester",
            "parent": 38,
            "description": "",
            "count": 0,
            "barcode": "",
            "_links": {
                "self": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/atum-locations/59"
                    }
                ],
                "collection": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/atum-locations"
                    }
                ],
                "up": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/products/atum-locations/38"
                    }
                ]
            }
        }
    ]
}

On this page