ATUM REST API

Suppliers

ATUM

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

The suppliers endpoints are only available when the ATUM Purchase Orders module is enabled. They require the ATUM supplier capabilities: read_private_suppliers to list them, read_supplier to view one, publish_suppliers to create them, edit_suppliers to update them, delete_supplier to delete them and edit_others_suppliers to use the batch endpoint.

Supplier properties

AttributeTypeDescription
idintegerUnique identifier for the resource. read-only
namestringSupplier name.
slugstringSupplier slug.
permalinkstringSupplier URL. read-only
date_createddate-timeThe date the supplier was created, in the site's timezone.
date_created_gmtdate-timeThe date the supplier was created, as GMT.
date_modifieddate-timeThe date the supplier was last modified, in the site's timezone. read-only
date_modified_gmtdate-timeThe date the supplier was last modified, as GMT. read-only
statusstringSupplier status (post status). Options: draft, pending, private, publish and trash. Default is publish.
codestringSupplier code.
tax_numberstringSupplier tax/VAT number.
phonestringSupplier phone number.
faxstringSupplier fax number.
websitestringSupplier website.
ordering_urlstringSupplier ordering URL.
general_emailstringSupplier general email.
ordering_emailstringSupplier ordering email.
descriptionstringSupplier description.
currencystringSupplier currency, in ISO format (any currency code supported by WooCommerce, such as EUR, GBP or USD).
addressstringSupplier address.
citystringSupplier city.
countrystringSupplier country ISO 3166 code. See ISO 3166 Codes (Countries) for more details.
statestringSupplier state.
zip_codestringSupplier ZIP code.
assigned_tointegerThe user ID that this supplier is assigned to.
locationstringThe location used in Purchase Orders assigned to this supplier.
discountnumberDiscount applied by the supplier (percentage).
tax_ratenumberTax rate applied by the supplier (percentage).
lead_timeintegerLead time (in days).
delivery_termsstringDelivery terms.
days_to_cancelintegerDays to cancel.
cancelation_policystringCancelation policy.
imageobjectSupplier featured image. Only present when the supplier has an image. See Supplier - Image properties.
meta_dataobjectMeta data. Only present when the supplier has custom meta data. See Supplier - Meta data properties. read-only

All the supplier data (from code to cancelation_policy) is returned as it's stored in the database, so the numeric values (such as assigned_to, discount or lead_time) come as strings, and any data that was never set comes as null. When updating a supplier, only the properties included in the request are changed.

Supplier - Image properties

AttributeTypeDescription
idintegerImage ID. Set it to an existing media ID to change the supplier image, or to 0 to remove it.
date_createddate-timeThe date the image was created, in the site's timezone. read-only
date_created_gmtdate-timeThe date the image was created, as GMT. read-only
date_modifieddate-timeThe date the image was last modified, in the site's timezone. read-only
date_modified_gmtdate-timeThe date the image was last modified, as GMT. read-only
srcstringImage URL.
namestringImage name.
altstringImage alternative text.

Supplier - Meta data properties

The meta_data property is an object with the supplier's public custom fields (the meta keys that don't start with an underscore), as meta_key: meta_value pairs. It can't be changed through the API.

"meta_data": {
    "my_custom_field": "Custom value"
}

Create a supplier

This API helps you to create a new supplier.

HTTP request

POST/wp-json/wc/v3/atum/suppliers
curl -X POST https://example.com/wp-json/wc/v3/atum/suppliers \
	-u consumer_key:consumer_secret \
	-H "Content-Type: application/json" \
	-d '{
      "name": "Supplier REST",
      "code": "4675763",
      "tax_number": "ES7667858Y",
      "phone": "+3412345678",
      "website": "https://example.com",
      "currency": "EUR",
      "address": "5th Avenue",
      "city": "London",
      "country": "GB",
      "assigned_to": 1,
      "location": "United Kingdom",
      "discount": 5,
      "lead_time": 7
    }'
JSON response example
{
    "id": 2159,
    "name": "Supplier REST",
    "slug": "supplier-rest",
    "permalink": "https://example.com/?post_type=atum_supplier&p=2159",
    "date_created": "2019-11-12T12:34:38",
    "date_created_gmt": "2019-11-12T11:34:38",
    "date_modified": "2019-11-12T12:34:38",
    "date_modified_gmt": "2019-11-12T11:34:38",
    "status": "publish",
    "address": "5th Avenue",
    "assigned_to": "1",
    "cancelation_policy": null,
    "days_to_cancel": null,
    "delivery_terms": null,
    "description": null,
    "discount": "5",
    "city": "London",
    "code": "4675763",
    "country": "GB",
    "currency": "EUR",
    "fax": null,
    "general_email": null,
    "lead_time": "7",
    "location": "United Kingdom",
    "ordering_email": null,
    "ordering_url": null,
    "phone": "+3412345678",
    "state": null,
    "tax_number": "ES7667858Y",
    "tax_rate": null,
    "website": "https://example.com",
    "zip_code": null,
    "_links": {
        "self": [
            {
                "href": "https://example.com/wp-json/wc/v3/atum/suppliers/2159"
            }
        ],
        "collection": [
            {
                "href": "https://example.com/wp-json/wc/v3/atum/suppliers"
            }
        ]
    }
}

Retrieve a supplier

This API lets you retrieve and view a specific supplier by ID.

HTTP request

GET/wp-json/wc/v3/atum/suppliers/<id>
curl https://example.com/wp-json/wc/v3/atum/suppliers/399 \
	-u consumer_key:consumer_secret
JSON response example
{
    "id": 399,
    "name": "Supplier 2",
    "slug": "supplier-2",
    "permalink": "https://example.com/?post_type=atum_supplier&p=399",
    "date_created": "2017-10-10T16:39:31",
    "date_created_gmt": "2017-10-10T15:39:31",
    "date_modified": "2017-10-10T17:39:58",
    "date_modified_gmt": "2017-10-10T16:39:58",
    "status": "publish",
    "address": null,
    "assigned_to": "1",
    "cancelation_policy": null,
    "days_to_cancel": null,
    "delivery_terms": null,
    "description": null,
    "discount": null,
    "city": null,
    "code": "56498498",
    "country": "ES",
    "currency": "EUR",
    "fax": null,
    "general_email": null,
    "lead_time": null,
    "location": null,
    "ordering_email": null,
    "ordering_url": null,
    "phone": "98498498",
    "state": "Valencia",
    "tax_number": "959+58548",
    "tax_rate": null,
    "website": null,
    "zip_code": null,
    "_links": {
        "self": [
            {
                "href": "https://example.com/wp-json/wc/v3/atum/suppliers/399"
            }
        ],
        "collection": [
            {
                "href": "https://example.com/wp-json/wc/v3/atum/suppliers"
            }
        ]
    }
}

List all suppliers

This API helps you to view all the suppliers.

HTTP request

GET/wp-json/wc/v3/atum/suppliers
curl https://example.com/wp-json/wc/v3/atum/suppliers \
	-u consumer_key:consumer_secret
JSON response example
[
    {
        "id": 2159,
        "name": "Supplier REST",
        "slug": "supplier-rest",
        "permalink": "https://example.com/?post_type=atum_supplier&p=2159",
        "date_created": "2019-11-12T12:34:38",
        "date_created_gmt": "2019-11-12T11:34:38",
        "date_modified": "2019-11-12T12:34:38",
        "date_modified_gmt": "2019-11-12T11:34:38",
        "status": "publish",
        "address": "5th Avenue",
        "assigned_to": "1",
        "cancelation_policy": null,
        "days_to_cancel": null,
        "delivery_terms": null,
        "description": null,
        "discount": "5",
        "city": "London",
        "code": "4675763",
        "country": "GB",
        "currency": "EUR",
        "fax": null,
        "general_email": null,
        "lead_time": "7",
        "location": "United Kingdom",
        "ordering_email": null,
        "ordering_url": null,
        "phone": "+3412345678",
        "state": null,
        "tax_number": "ES7667858Y",
        "tax_rate": null,
        "website": "https://example.com",
        "zip_code": null,
        "_links": {
            "self": [
                {
                    "href": "https://example.com/wp-json/wc/v3/atum/suppliers/2159"
                }
            ],
            "collection": [
                {
                    "href": "https://example.com/wp-json/wc/v3/atum/suppliers"
                }
            ]
        }
    },
    {
        "id": 545,
        "name": "BOM Supplier",
        "slug": "bom-supplier",
        "permalink": "https://example.com/?post_type=atum_supplier&p=545",
        "date_created": "2018-06-11T07:14:58",
        "date_created_gmt": "2018-06-11T06:14:58",
        "date_modified": "2019-09-27T12:30:30",
        "date_modified_gmt": "2019-09-27T10:30:30",
        "status": "publish",
        "address": null,
        "assigned_to": "1",
        "cancelation_policy": null,
        "days_to_cancel": null,
        "delivery_terms": null,
        "description": null,
        "discount": null,
        "city": null,
        "code": "854984984",
        "country": "CU",
        "currency": "BTC",
        "fax": null,
        "general_email": null,
        "lead_time": null,
        "location": null,
        "ordering_email": null,
        "ordering_url": null,
        "phone": null,
        "state": null,
        "tax_number": "85489489",
        "tax_rate": null,
        "website": null,
        "zip_code": null,
        "image": {
            "id": 69,
            "date_created": "2013-06-07T13:22:05",
            "date_created_gmt": "2013-06-07T11:22:05",
            "date_modified": "2013-06-07T13:22:05",
            "date_modified_gmt": "2013-06-07T11:22:05",
            "src": "https://example.com/wp-content/uploads/2013/06/Poster_1_flat.jpg",
            "name": "Poster_1_flat",
            "alt": ""
        },
        "_links": {
            "self": [
                {
                    "href": "https://example.com/wp-json/wc/v3/atum/suppliers/545"
                }
            ],
            "collection": [
                {
                    "href": "https://example.com/wp-json/wc/v3/atum/suppliers"
                }
            ]
        }
    },
    {
        "id": 426,
        "name": "New Supplier",
        "slug": "newsupplier",
        "permalink": "https://example.com/?post_type=atum_supplier&p=426",
        "date_created": "2018-01-10T15:58:10",
        "date_created_gmt": "2018-01-10T15:58:10",
        "date_modified": "2018-01-17T07:56:11",
        "date_modified_gmt": "2018-01-17T07:56:11",
        "status": "publish",
        "address": "Elm Street, 19",
        "assigned_to": "1",
        "cancelation_policy": null,
        "days_to_cancel": null,
        "delivery_terms": null,
        "description": null,
        "discount": null,
        "city": "Madrid",
        "code": "AAABBB",
        "country": "ES",
        "currency": "ARS",
        "fax": null,
        "general_email": null,
        "lead_time": null,
        "location": null,
        "ordering_email": null,
        "ordering_url": null,
        "phone": "321654",
        "state": "Madrid",
        "tax_number": "1234567",
        "tax_rate": null,
        "website": null,
        "zip_code": "24001",
        "_links": {
            "self": [
                {
                    "href": "https://example.com/wp-json/wc/v3/atum/suppliers/426"
                }
            ],
            "collection": [
                {
                    "href": "https://example.com/wp-json/wc/v3/atum/suppliers"
                }
            ]
        }
    },
    {
        "id": 399,
        "name": "Supplier 2",
        "slug": "supplier-2",
        "permalink": "https://example.com/?post_type=atum_supplier&p=399",
        "date_created": "2017-10-10T16:39:31",
        "date_created_gmt": "2017-10-10T15:39:31",
        "date_modified": "2017-10-10T17:39:58",
        "date_modified_gmt": "2017-10-10T16:39:58",
        "status": "publish",
        "address": null,
        "assigned_to": "1",
        "cancelation_policy": null,
        "days_to_cancel": null,
        "delivery_terms": null,
        "description": null,
        "discount": null,
        "city": null,
        "code": "56498498",
        "country": "ES",
        "currency": "EUR",
        "fax": null,
        "general_email": null,
        "lead_time": null,
        "location": null,
        "ordering_email": null,
        "ordering_url": null,
        "phone": "98498498",
        "state": "Valencia",
        "tax_number": "959+58548",
        "tax_rate": null,
        "website": null,
        "zip_code": null,
        "_links": {
            "self": [
                {
                    "href": "https://example.com/wp-json/wc/v3/atum/suppliers/399"
                }
            ],
            "collection": [
                {
                    "href": "https://example.com/wp-json/wc/v3/atum/suppliers"
                }
            ]
        }
    }
]

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.
afterstringLimit response to resources published after a given ISO8601 compliant date.
beforestringLimit response to resources published before a given ISO8601 compliant date.
modified_afterstringLimit response to resources modified after a given ISO8601 compliant date.
modified_beforestringLimit response to resources modified before a given ISO8601 compliant date.
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 desc.
orderbystringSort collection by object attribute. Options: date, id, include, title, slug and modified. Default is date.
slugstringLimit result set to suppliers with a specific slug.
statusstringLimit result set to suppliers assigned a specific status. Multiple statuses can be passed separated by commas. Options: any, draft, pending, private, publish and trash. Default is any.
currencystringLimit result set to suppliers using the specified currency code, in ISO format (any currency code supported by WooCommerce).
countrystringLimit result set to suppliers from the specified ISO 3166 country code. See ISO 3166 Codes (Countries) for more details.
assigned_tointegerLimit result set to suppliers assigned to the specified user ID.
productintegerLimit result set to suppliers assigned to the specific product ID.
dates_are_gmtbooleanWhether to consider GMT post dates when limiting response by published or modified date. Default is false.

Update a supplier

This API lets you make changes to a supplier.

HTTP request

PUT/wp-json/wc/v3/atum/suppliers/<id>
curl -X PUT https://example.com/wp-json/wc/v3/atum/suppliers/399 \
	-u consumer_key:consumer_secret \
	-H "Content-Type: application/json" \
	-d '{
      "country": "ES",
      "location": "Spain"
    }'
JSON response example
{
    "id": 399,
    "name": "Supplier 2",
    "slug": "supplier-2",
    "permalink": "https://example.com/?post_type=atum_supplier&p=399",
    "date_created": "2017-10-10T16:39:31",
    "date_created_gmt": "2017-10-10T15:39:31",
    "date_modified": "2019-11-12T13:26:49",
    "date_modified_gmt": "2019-11-12T12:26:49",
    "status": "publish",
    "address": null,
    "assigned_to": "1",
    "cancelation_policy": null,
    "days_to_cancel": null,
    "delivery_terms": null,
    "description": null,
    "discount": null,
    "city": null,
    "code": "56498498",
    "country": "ES",
    "currency": "EUR",
    "fax": null,
    "general_email": null,
    "lead_time": null,
    "location": "Spain",
    "ordering_email": null,
    "ordering_url": null,
    "phone": "98498498",
    "state": "Valencia",
    "tax_number": "959+58548",
    "tax_rate": null,
    "website": null,
    "zip_code": null,
    "_links": {
        "self": [
            {
                "href": "https://example.com/wp-json/wc/v3/atum/suppliers/399"
            }
        ],
        "collection": [
            {
                "href": "https://example.com/wp-json/wc/v3/atum/suppliers"
            }
        ]
    }
}

Delete a supplier

This API helps you delete a supplier.

HTTP request

DELETE/wp-json/wc/v3/atum/suppliers/<id>
curl -X DELETE https://example.com/wp-json/wc/v3/atum/suppliers/2159?force=true \
	-u consumer_key:consumer_secret
JSON response example
{
    "id": 2159,
    "name": "Supplier REST",
    "slug": "supplier-rest",
    "permalink": "https://example.com/?post_type=atum_supplier&p=2159",
    "date_created": "2019-11-12T12:34:38",
    "date_created_gmt": "2019-11-12T11:34:38",
    "date_modified": "2019-11-12T12:34:38",
    "date_modified_gmt": "2019-11-12T11:34:38",
    "status": "publish",
    "address": "5th Avenue",
    "assigned_to": "1",
    "cancelation_policy": null,
    "days_to_cancel": null,
    "delivery_terms": null,
    "description": null,
    "discount": "5",
    "city": "London",
    "code": "4675763",
    "country": "GB",
    "currency": "EUR",
    "fax": null,
    "general_email": null,
    "lead_time": "7",
    "location": "United Kingdom",
    "ordering_email": null,
    "ordering_url": null,
    "phone": "+3412345678",
    "state": null,
    "tax_number": "ES7667858Y",
    "tax_rate": null,
    "website": "https://example.com",
    "zip_code": null,
    "_links": {
        "self": [
            {
                "href": "https://example.com/wp-json/wc/v3/atum/suppliers/2159"
            }
        ],
        "collection": [
            {
                "href": "https://example.com/wp-json/wc/v3/atum/suppliers"
            }
        ]
    }
}

Available parameters

ParameterTypeDescription
forcebooleanUse true whether to permanently delete the supplier (bypassing the trash). When a supplier is permanently deleted, it's also unlinked from all its products. Default is false.

Batch update suppliers

This API helps you to batch create, update and delete multiple suppliers. The suppliers deleted through this endpoint are permanently deleted (as if force was true).

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

HTTP request

POST/wp-json/wc/v3/atum/suppliers/batch
curl -X POST https://example.com/wp-json/wc/v3/atum/suppliers/batch \
	-u consumer_key:consumer_secret \
	-H "Content-Type: application/json" \
	-d '{
      "create": [
        {
          "name": "TEST Batch Supplier",
          "tax_number": "GB87263874"
        },
        {
          "name": "TEST Batch Supplier 2",
          "address": "Saints Street, 500"
        }
      ],
      "update": [
        {
          "id": 426,
          "code": "ABC123"
        }
      ],
      "delete": [
        1817
      ]
    }'
JSON response example
{
    "create": [
        {
            "id": 2161,
            "name": "TEST Batch Supplier",
            "slug": "test-batch-supplier",
            "permalink": "https://example.com/?post_type=atum_supplier&p=2161",
            "date_created": "2019-11-12T13:37:55",
            "date_created_gmt": "2019-11-12T12:37:55",
            "date_modified": "2019-11-12T13:37:55",
            "date_modified_gmt": "2019-11-12T12:37:55",
            "status": "publish",
            "address": null,
            "assigned_to": null,
            "cancelation_policy": null,
            "days_to_cancel": null,
            "delivery_terms": null,
            "description": null,
            "discount": null,
            "city": null,
            "code": null,
            "country": null,
            "currency": null,
            "fax": null,
            "general_email": null,
            "lead_time": null,
            "location": null,
            "ordering_email": null,
            "ordering_url": null,
            "phone": null,
            "state": null,
            "tax_number": "GB87263874",
            "tax_rate": null,
            "website": null,
            "zip_code": null,
            "_links": {
                "self": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/atum/suppliers/2161"
                    }
                ],
                "collection": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/atum/suppliers"
                    }
                ]
            }
        },
        {
            "id": 2162,
            "name": "TEST Batch Supplier 2",
            "slug": "test-batch-supplier-2",
            "permalink": "https://example.com/?post_type=atum_supplier&p=2162",
            "date_created": "2019-11-12T13:37:55",
            "date_created_gmt": "2019-11-12T12:37:55",
            "date_modified": "2019-11-12T13:37:55",
            "date_modified_gmt": "2019-11-12T12:37:55",
            "status": "publish",
            "address": "Saints Street, 500",
            "assigned_to": null,
            "cancelation_policy": null,
            "days_to_cancel": null,
            "delivery_terms": null,
            "description": null,
            "discount": null,
            "city": null,
            "code": null,
            "country": null,
            "currency": null,
            "fax": null,
            "general_email": null,
            "lead_time": null,
            "location": null,
            "ordering_email": null,
            "ordering_url": null,
            "phone": null,
            "state": null,
            "tax_number": null,
            "tax_rate": null,
            "website": null,
            "zip_code": null,
            "_links": {
                "self": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/atum/suppliers/2162"
                    }
                ],
                "collection": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/atum/suppliers"
                    }
                ]
            }
        }
    ],
    "update": [
        {
            "id": 426,
            "name": "New Supplier",
            "slug": "newsupplier",
            "permalink": "https://example.com/?post_type=atum_supplier&p=426",
            "date_created": "2018-01-10T15:58:10",
            "date_created_gmt": "2018-01-10T15:58:10",
            "date_modified": "2019-11-12T13:37:55",
            "date_modified_gmt": "2019-11-12T12:37:55",
            "status": "publish",
            "address": "Elm Street, 19",
            "assigned_to": "1",
            "cancelation_policy": null,
            "days_to_cancel": null,
            "delivery_terms": null,
            "description": null,
            "discount": null,
            "city": "Madrid",
            "code": "ABC123",
            "country": "ES",
            "currency": "ARS",
            "fax": null,
            "general_email": null,
            "lead_time": null,
            "location": null,
            "ordering_email": null,
            "ordering_url": null,
            "phone": "321654",
            "state": "Madrid",
            "tax_number": "1234567",
            "tax_rate": null,
            "website": null,
            "zip_code": "24001",
            "_links": {
                "self": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/atum/suppliers/426"
                    }
                ],
                "collection": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/atum/suppliers"
                    }
                ]
            }
        }
    ],
    "delete": [
        {
            "id": 1817,
            "name": "REST old supplier",
            "slug": "rest-old-supplier",
            "permalink": "https://example.com/?post_type=atum_supplier&p=1817",
            "date_created": "2019-09-30T13:55:51",
            "date_created_gmt": "2019-09-30T11:55:51",
            "date_modified": "2019-09-30T13:55:51",
            "date_modified_gmt": "2019-09-30T11:55:51",
            "status": "publish",
            "address": null,
            "assigned_to": "1",
            "cancelation_policy": null,
            "days_to_cancel": null,
            "delivery_terms": null,
            "description": null,
            "discount": null,
            "city": null,
            "code": "675675GQA",
            "country": "ES",
            "currency": "EUR",
            "fax": null,
            "general_email": null,
            "lead_time": null,
            "location": null,
            "ordering_email": null,
            "ordering_url": null,
            "phone": null,
            "state": null,
            "tax_number": null,
            "tax_rate": null,
            "website": null,
            "zip_code": null,
            "_links": {
                "self": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/atum/suppliers/1817"
                    }
                ],
                "collection": [
                    {
                        "href": "https://example.com/wp-json/wc/v3/atum/suppliers"
                    }
                ]
            }
        }
    ]
}

On this page