Suppliers
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
| Attribute | Type | Description |
|---|---|---|
id | integer | Unique identifier for the resource. read-only |
name | string | Supplier name. |
slug | string | Supplier slug. |
permalink | string | Supplier URL. read-only |
date_created | date-time | The date the supplier was created, in the site's timezone. |
date_created_gmt | date-time | The date the supplier was created, as GMT. |
date_modified | date-time | The date the supplier was last modified, in the site's timezone. read-only |
date_modified_gmt | date-time | The date the supplier was last modified, as GMT. read-only |
status | string | Supplier status (post status). Options: draft, pending, private, publish and trash. Default is publish. |
code | string | Supplier code. |
tax_number | string | Supplier tax/VAT number. |
phone | string | Supplier phone number. |
fax | string | Supplier fax number. |
website | string | Supplier website. |
ordering_url | string | Supplier ordering URL. |
general_email | string | Supplier general email. |
ordering_email | string | Supplier ordering email. |
description | string | Supplier description. |
currency | string | Supplier currency, in ISO format (any currency code supported by WooCommerce, such as EUR, GBP or USD). |
address | string | Supplier address. |
city | string | Supplier city. |
country | string | Supplier country ISO 3166 code. See ISO 3166 Codes (Countries) for more details. |
state | string | Supplier state. |
zip_code | string | Supplier ZIP code. |
assigned_to | integer | The user ID that this supplier is assigned to. |
location | string | The location used in Purchase Orders assigned to this supplier. |
discount | number | Discount applied by the supplier (percentage). |
tax_rate | number | Tax rate applied by the supplier (percentage). |
lead_time | integer | Lead time (in days). |
delivery_terms | string | Delivery terms. |
days_to_cancel | integer | Days to cancel. |
cancelation_policy | string | Cancelation policy. |
image | object | Supplier featured image. Only present when the supplier has an image. See Supplier - Image properties. |
meta_data | object | Meta 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
| Attribute | Type | Description |
|---|---|---|
id | integer | Image ID. Set it to an existing media ID to change the supplier image, or to 0 to remove it. |
date_created | date-time | The date the image was created, in the site's timezone. read-only |
date_created_gmt | date-time | The date the image was created, as GMT. read-only |
date_modified | date-time | The date the image was last modified, in the site's timezone. read-only |
date_modified_gmt | date-time | The date the image was last modified, as GMT. read-only |
src | string | Image URL. |
name | string | Image name. |
alt | string | Image 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
/wp-json/wc/v3/atum/supplierscurl -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
}'{
"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
/wp-json/wc/v3/atum/suppliers/<id>curl https://example.com/wp-json/wc/v3/atum/suppliers/399 \
-u consumer_key:consumer_secret{
"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
/wp-json/wc/v3/atum/supplierscurl https://example.com/wp-json/wc/v3/atum/suppliers \
-u consumer_key:consumer_secret[
{
"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
| Parameter | Type | Description |
|---|---|---|
context | string | Scope under which the request is made; determines fields present in response. Options: view and edit. Default is view. |
page | integer | Current page of the collection. Default is 1. |
per_page | integer | Maximum number of items to be returned in result set. Default is 10. Maximum is 100. |
search | string | Limit results to those matching a string. |
after | string | Limit response to resources published after a given ISO8601 compliant date. |
before | string | Limit response to resources published before a given ISO8601 compliant date. |
modified_after | string | Limit response to resources modified after a given ISO8601 compliant date. |
modified_before | string | Limit response to resources modified before a given ISO8601 compliant date. |
exclude | array | Ensure result set excludes specific IDs. |
include | array | Limit result set to specific ids. |
offset | integer | Offset the result set by a specific number of items. |
order | string | Order sort attribute ascending or descending. Options: asc and desc. Default is desc. |
orderby | string | Sort collection by object attribute. Options: date, id, include, title, slug and modified. Default is date. |
slug | string | Limit result set to suppliers with a specific slug. |
status | string | Limit 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. |
currency | string | Limit result set to suppliers using the specified currency code, in ISO format (any currency code supported by WooCommerce). |
country | string | Limit result set to suppliers from the specified ISO 3166 country code. See ISO 3166 Codes (Countries) for more details. |
assigned_to | integer | Limit result set to suppliers assigned to the specified user ID. |
product | integer | Limit result set to suppliers assigned to the specific product ID. |
dates_are_gmt | boolean | Whether 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
/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"
}'{
"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
/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{
"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
| Parameter | Type | Description |
|---|---|---|
force | boolean | Use 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
/wp-json/wc/v3/atum/suppliers/batchcurl -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
]
}'{
"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"
}
]
}
}
]
}