Introduction
MultiVendorX have been fully integrated with WordPress REST API. This will now let developers interact with sites remotely by sending and receiving JSON objects. When a data is sent out or a HTTP(S) request is made to the API from external applications, the response will be returned in JSON, thereby allowing MultiVendorX data to be created, read, updated or deleted.
MultiVendorX REST API has been introduced extending WordPress REST API and WooCommerce REST API.
Prerequisites
To use MultiVendorX REST API make sure you are using:
- MultiVendorX.
- WooCommerce 3.0+.
- WordPress 4.7+.
- Pretty permalinks in
Settings > Permalinks
so that the custom endpoints are supported. Default permalinks will not work. - You may access the API over either HTTP or HTTPS.
JSONP
JSONP is a method for sending JSON data without worrying about cross-domain issues. The JSON data is wrapped up in a callback function as a parameter inside it, but obviously keeping in mind the function exists on the client.
MultiVendorX REST API supports JSONP by default about which you may read it here.
A syntactical representation of a JSONP request is provided below:
/wp-json/mvx/v1/.../?_jsonp=callback
curl https://example.com/wp-json/mvx/v1/vendors/14?_jsonp=vendorDetails \
-u consumer_key:consumer_secret
Response:
/**/vendorDetails({"id":14,"login":"alex","first_name":"Alex","last_name":"Sarnal","nice_name":"alex","display_name":"alex","email":"alex@example.com","url":"","registered":"2018-05-31 13:29:05","status":"0","roles":["dc_vendor"],"allcaps":{"read":true,"manage_product":true,"edit_posts":true,"delete_posts":false,"view_woocommerce_reports":true,"assign_product_terms":true,"upload_files":true,"read_product":true,"read_shop_coupon":true,"edit_product":true,"delete_product":true,"edit_products":true,"delete_products":true,"publish_products":true,"edit_published_products":true,"delete_published_products":true,"edit_shop_coupon":true,"edit_shop_coupons":true,"delete_shop_coupon":true,"delete_shop_coupons":true,"publish_shop_coupons":true,"edit_published_shop_coupons":true,"delete_published_shop_coupons":true,"vendor_import_capability":true,"vendor_export_capability":true,"dc_vendor":true},"timezone_string":"","gmt_offset":"","shop":{"url":"http:\/\/example.com\/vendor\/alex\/","title":"alex","slug":"alex","description":"","image":"","banner":""},"address":{"address_1":"","address_2":"","city":"","state":"","country":"","postcode":"","phone":""},"social":{"facebook":"","twitter":"","google_plus":"","linkdin":"","youtube":"","instagram":""},"payment":{"payment_mode":"mangopay_gateway","bank_account_type":"current","bank_name":"","bank_account_number":"","bank_address":"","account_holder_name":"","aba_routing_number":"","destination_currency":"","iban":"","paypal_email":""},"message_to_buyers":"","review":0,"_links":{"self":[{"href":"http:\/\/example.com\/wp-json\/mvx\/v1\/vendors\/14"}],"collection":[{"href":"http:\/\/example.com\/wp-json\/mvx\/v1\/vendors"}]}})
Starting Out
Generate API credentials (Consumer Key & Consumer Secret) following instructions listed in http://docs.woocommerce.com/document/woocommerce-rest-api/ or you may also want to read through https://woocommerce.github.io/woocommerce-rest-api-docs/#authentication to authenticate with the MultiVendorX REST API.
We do not create a different credential set, rather we use WooCommerce's API credentials thereby you need to authenticate only once.
HTTP Methods
Use HTTP methods to map CRUD (create, retrieve, update, delete) operations to HTTP requests. Depending on your task, you can use any of the four methods listed below:
HTTP methods | Operations | Syntax |
---|---|---|
GET |
Retrieve / List information | GET /wp-json/mvx/v1/.../ |
POST |
Create an item | POST /wp-json/mvx/v1/.../ |
PUT |
Update a pre-existing item | PUT /wp-json/mvx/v1/.../ |
DELETE |
Remove an item | DELETE /wp-json/mvx/v1/.../ |
Sending a HTTP Request
A syntactical representation of a HTTP request is provided below:
/wp-json/mvx/v1
curl https://example.com/wp-json/mvx/v1/
Response:
{
"namespace": "mvx/v1",
"routes": {
"/mvx/v1": {
"namespace": "mvx/v1",
"methods": [
"GET"
],
"endpoints": [
{
"methods": [
"GET"
],
"args": {
"namespace": {
"required": false,
"default": "mvx/v1"
},
"context": {
"required": false,
"default": "view"
}
}
}
],
"_links": {
"self": "http://example.com/wp-json/mvx/v1"
}
},
"/mvx/v1/vendors": {
"namespace": "mvx/v1",
"methods": [
"GET",
"POST"
],
"endpoints": [
{
"methods": [
"GET"
],
"args": {
"context": {
"required": false,
"enum": [
"view",
"edit"
],
"description": "Scope under which the request is made; determines fields present in response.",
"type": "string"
},
"page": {
"required": false,
"default": 1,
"description": "Current page of the collection.",
"type": "integer"
},
"per_page": {
"required": false,
"default": 10,
"description": "Maximum number of items to be returned in result set.",
"type": "integer"
},
"search": {
"required": false,
"description": "Limit results to those matching a string.",
"type": "string"
}
}
},
{
"methods": [
"POST"
],
"args": []
}
],
"_links": {
"self": "http://example.com/wp-json/mvx/v1/vendors"
}
},
"/mvx/v1/vendors/(?P<id>[\\d]+)": {
"namespace": "mvx/v1",
"methods": [
"GET",
"POST",
"PUT",
"PATCH",
"DELETE"
],
"endpoints": [
{
"methods": [
"GET"
],
"args": {
"id": {
"required": false,
"description": "Unique identifier for the resource.",
"type": "integer"
},
"context": {
"required": false,
"default": "view",
"enum": [
"view",
"edit"
],
"description": "Scope under which the request is made; determines fields present in response.",
"type": "string"
}
}
},
{
"methods": [
"POST",
"PUT",
"PATCH"
],
"args": {
"id": {
"required": false,
"description": "Unique identifier for the resource.",
"type": "integer"
}
}
},
{
"methods": [
"DELETE"
],
"args": {
"id": {
"required": false,
"description": "Unique identifier for the resource.",
"type": "integer"
}
}
}
]
},
"/mvx/v1/vendors/batch": {
"namespace": "mvx/v1",
"methods": [
"POST",
"PUT",
"PATCH"
],
"endpoints": [
{
"methods": [
"POST",
"PUT",
"PATCH"
],
"args": []
}
],
"_links": {
"self": "http://example.com/wp-json/mvx/v1/vendors/batch"
}
}
},
"_links": {
"up": [
{
"href": "http://example.com/wp-json/"
}
]
}
}
Pagination
MultiVendorX REST API supports pagination therefore you can also paginate results returned by MultiVendorX REST API in the same way WordPress does. If a request returns multiple items it will be paginated to 10 items automatically. However, you can change the default behaviour by specifying the ?per_page
parameter. The syntax for the same would be:
GET /vendors?per_page=15
To change the number of pages that shall be displayed with the result, you can alter the ?page
parameter:
GET /vendors?page=2
In order to skip a certain number of results before starting output you can specify a number ( to be skipped ) using the ?offset
parameter:
GET /vendors?offset=5
Generic Errors
Some rare times you might encounter errors when accessing the REST API. There are three possible types:
Error Code | Error Type |
---|---|
400 Bad Request |
Invalid request, e.g. using an unsupported HTTP method |
401 Unauthorized |
Authentication or permission error, e.g. incorrect API keys |
404 Not Found |
Requests to resources that don't exist or are missing |
500 Internal Server Error |
Server error |
MultiVendorX REST API 401 error example:
{
"code": "mvx_rest_cannot_create",
"message": "Sorry, you cannot create vendors.",
"data": {
"status": 401
}
}
MultiVendorX REST API 404 error example:
{
"code": "woocommerce_rest_shop_coupon_invalid_id",
"message": "Invalid coupon ID.",
"data": {
"status": 404
}
}
Errors, as well returns a response object in JSON format which contains a code
, message
and data
attribute.
Vendors
MultiVendorX vendors API allows you to create, view, update, and delete individual, or a batch of vendors remotely through another application.
Accepted Parameters
Attribute | Description |
---|---|
id |
Unique identifier for the resource. Generated automatically in POST request. |
login |
Username of the vendor. mandatory |
first_name |
Vendor's first name. |
last_name |
Vendor's last name. |
nice_name |
The sanitized version of vendor's username. |
display_name |
The name to be displayed publicly. |
email |
The email address for the customer. mandatory |
url |
Vendor's website address. |
password |
Vendor's account password. |
roles |
Assigned user role. Automatically set to dc_vendor . |
timezone_string |
Vendor's timezone. Example: Asia/Kolkata. Either timezone_string or gmt_offset |
gmt_offset |
Vendor's timezone. Example: 5.5 ( if the vendor is in a timezone: say UTC+5:30, then gmt_offset is calculated as a fraction and changed to 5.5, or, if the vendor is in a timezone say UTC+6:00, then gmt_offset will be 6 ). |
shop |
Array of shop details. Read More. |
address |
Array of vendor's shop address. Read More. |
social |
Array of vendor's social links. Read More. |
payment |
Array of vendor's payment details. Read More. |
message_to_buyers |
A message that the vendor wants to display to their customers. |
Accepted Parameters - Vendor Shop Details
Attribute | Description |
---|---|
description |
Vendor's shop description. |
Accepted Parameters - Vendor Shop Address
Attribute | Description |
---|---|
address_1 |
Vendor's Address Line 1. |
address_2 |
Vendor's Address Line 2. |
city |
Vendor's city. |
state |
Vendor's state. |
country |
Vendor's country. |
postcode |
Vendor's ZIP/Postcode. |
phone |
Vendor's phone. |
Accepted Parameters - Vendor Social Links
Attribute | Description |
---|---|
facebook |
Vendor's Facebook Profile Address. |
twitter |
Vendor's Twitter Profile Address. |
google_plus |
Vendor's Google Plus Profile Address. |
linkdin |
Vendor's LinkedIn Profile Address. |
youtube |
Vendor's YouTube Profile Address. |
instagram |
Vendor's Instagram Profile Address. |
Accepted Parameters - Vendor Payment Details
Attribute | Description |
---|---|
payment_mode |
Mode of vendor's payment : Direct Bank Transfer (direct_bank ) or PayPal (paypal_payout or paypal_masspay ). |
bank_account_type |
If payment is direct_bank : then vendor's sccount type: current or savings . |
bank_name |
Vendor's Bank Name. |
bank_account_number |
Vendor's Bank Account Number. |
bank_address |
Vendor's Bank Address. |
account_holder_name |
Vendor's Account Holder Name. |
aba_routing_number |
Vendor's ABA Routing Number. |
destination_currency |
Vendor's Destination Currency. |
iban |
Vendor's IBAN. |
paypal_email |
Vendor's PayPal Email. |
Create a Vendor
A new vendor can be created by calling the MultiVendorX vendors API and using the POST
method.
/wp-json/mvx/v1/vendors
A vendor will be registered on your site and is ready to sell upon successful API call.
curl -X POST https://example.com/wp-json/mvx/v1/vendors \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"login": "ria",
"first_name": "Ria",
"last_name": "Cooper",
"nice_name": "ria",
"display_name": "Ria",
"email": "ria@example.com",
"url": "https://example.com"
}'
Response:
{
"id": 19,
"login": "ria",
"first_name": "Ria",
"last_name": "Cooper",
"nice_name": "ria",
"display_name": "Ria",
"email": "ria@example.com",
"url": "",
"registered": "2018-06-27 06:17:18",
"status": "0",
"roles": [
"dc_vendor"
],
"allcaps": {
"read": true,
"manage_product": true,
"edit_posts": true,
"delete_posts": false,
"view_woocommerce_reports": true,
"assign_product_terms": true,
"upload_files": true,
"read_product": true,
"read_shop_coupon": true,
"edit_product": true,
"delete_product": true,
"edit_products": true,
"delete_products": true,
"publish_products": true,
"edit_published_products": true,
"delete_published_products": true,
"edit_shop_coupon": true,
"edit_shop_coupons": true,
"delete_shop_coupon": true,
"delete_shop_coupons": true,
"publish_shop_coupons": true,
"edit_published_shop_coupons": true,
"delete_published_shop_coupons": true,
"vendor_import_capability": true,
"vendor_export_capability": true,
"dc_vendor": true
},
"timezone_string": "",
"gmt_offset": "",
"shop": {
"url": "http://example.com/vendor/ria/",
"title": "ria",
"slug": "ria",
"description": "",
"image": "",
"banner": ""
},
"address": {
"address_1": "",
"address_2": "",
"city": "",
"state": "",
"country": "",
"postcode": "",
"phone": ""
},
"social": {
"facebook": "",
"twitter": "",
"google_plus": "",
"linkdin": "",
"youtube": "",
"instagram": ""
},
"payment": {
"payment_mode": "",
"bank_account_type": "",
"bank_name": "",
"bank_account_number": "",
"bank_address": "",
"account_holder_name": "",
"aba_routing_number": "",
"destination_currency": "",
"iban": "",
"paypal_email": ""
},
"message_to_buyers": "",
"review": 0,
"_links": {
"self": [
{
"href": "http://example.com/wp-json/mvx/v1/vendors/19"
}
],
"collection": [
{
"href": "http://example.com/wp-json/mvx/v1/vendors"
}
]
}
}
Debugging
Error Code | Debugging |
---|---|
400 mvx_rest_dc_vendor_exists |
A resource is already registerred with the id you've provided |
400 mvx_rest_dc_vendor_login_empty |
You've missed filling out the username in the login field |
400 mvx_rest_dc_vendor_email_empty |
You've missed filling out the email in the email field |
MultiVendorX REST API 400 error example:
{
"code": "mvx_rest_dc_vendor_login_empty",
"message": "dc_vendor login required.",
"data": {
"status": 400
}
}
Get all Vendors
List all the vendors registered on your site by calling the MultiVendorX vendors API and using the GET
method.
/wp-json/mvx/v1/vendors
curl https://example.com/wp-json/mvx/v1/vendors \
-u consumer_key:consumer_secret
Response:
[
{
"id": 17,
"login": "james",
"first_name": "James",
"last_name": "Goody",
"nice_name": "james",
"display_name": "Jaina",
"email": "james@example.com",
"url": "https://example.com",
"registered": "2018-06-26 07:47:23",
"status": "0",
"roles": [
"dc_vendor"
],
"allcaps": {
"read": true,
"manage_product": true,
"edit_posts": true,
"delete_posts": false,
"view_woocommerce_reports": true,
"assign_product_terms": true,
"upload_files": true,
"read_product": true,
"read_shop_coupon": true,
"edit_product": true,
"delete_product": true,
"edit_products": true,
"delete_products": true,
"publish_products": true,
"edit_published_products": true,
"delete_published_products": true,
"edit_shop_coupon": true,
"edit_shop_coupons": true,
"delete_shop_coupon": true,
"delete_shop_coupons": true,
"publish_shop_coupons": true,
"edit_published_shop_coupons": true,
"delete_published_shop_coupons": true,
"vendor_import_capability": true,
"vendor_export_capability": true,
"dc_vendor": true
},
"timezone_string": "",
"gmt_offset": "",
"shop": {
"url": "http://example.com/vendor/james/",
"title": "james",
"slug": "james",
"description": "",
"image": "",
"banner": ""
},
"address": {
"address_1": "56 Mounthoolie Lane",
"address_2": "",
"city": "SUTTON BASSETT",
"state": "Northamptonshire",
"country": "GB",
"postcode": "LE16 7EL",
"phone": "917-729-7017"
},
"social": {
"facebook": "",
"twitter": "",
"google_plus": "",
"linkdin": "",
"youtube": "",
"instagram": ""
},
"payment": {
"payment_mode": "",
"bank_account_type": "",
"bank_name": "",
"bank_account_number": "",
"bank_address": "",
"account_holder_name": "",
"aba_routing_number": "",
"destination_currency": "",
"iban": "",
"paypal_email": ""
},
"message_to_buyers": "",
"review": 0,
"_links": {
"self": [
{
"href": "http://example.com/wp-json/mvx/v1/vendors/17"
}
],
"collection": [
{
"href": "http://example.com/wp-json/mvx/v1/vendors"
}
]
}
},
{
"id": 19,
"login": "ria",
"first_name": "Ria",
"last_name": "Cooper",
"nice_name": "ria",
"display_name": "ria",
"email": "ria@example.com",
"url": "",
"registered": "2018-06-27 06:17:18",
"status": "0",
"roles": [
"dc_vendor"
],
"allcaps": {
"read": true,
"manage_product": true,
"edit_posts": true,
"delete_posts": false,
"view_woocommerce_reports": true,
"assign_product_terms": true,
"upload_files": true,
"read_product": true,
"read_shop_coupon": true,
"edit_product": true,
"delete_product": true,
"edit_products": true,
"delete_products": true,
"publish_products": true,
"edit_published_products": true,
"delete_published_products": true,
"edit_shop_coupon": true,
"edit_shop_coupons": true,
"delete_shop_coupon": true,
"delete_shop_coupons": true,
"publish_shop_coupons": true,
"edit_published_shop_coupons": true,
"delete_published_shop_coupons": true,
"vendor_import_capability": true,
"vendor_export_capability": true,
"dc_vendor": true
},
"timezone_string": "",
"gmt_offset": "",
"shop": {
"url": "http://example.com/vendor/ria/",
"title": "ria",
"slug": "ria",
"description": "",
"image": "",
"banner": ""
},
"address": {
"address_1": "",
"address_2": "",
"city": "",
"state": "",
"country": "",
"postcode": "",
"phone": ""
},
"social": {
"facebook": "",
"twitter": "",
"google_plus": "",
"linkdin": "",
"youtube": "",
"instagram": ""
},
"payment": {
"payment_mode": "",
"bank_account_type": "",
"bank_name": "",
"bank_account_number": "",
"bank_address": "",
"account_holder_name": "",
"aba_routing_number": "",
"destination_currency": "",
"iban": "",
"paypal_email": ""
},
"message_to_buyers": "",
"review": 0,
"_links": {
"self": [
{
"href": "http://example.com/wp-json/mvx/v1/vendors/19"
}
],
"collection": [
{
"href": "http://example.com/wp-json/mvx/v1/vendors"
}
]
}
}
]
Retrieve a Specific Vendor
Get a specific vendor's details by calling the MultiVendorX vendors API and using the GET
method.
/wp-json/mvx/v1/vendors/[id]
curl https://example.com/wp-json/mvx/v1/vendors/19 \
-u consumer_key:consumer_secret
Response:
[
{
"id": 19,
"login": "ria",
"first_name": "Ria",
"last_name": "Cooper",
"nice_name": "ria",
"display_name": "ria",
"email": "ria@example.com",
"url": "",
"registered": "2018-06-27 06:17:18",
"status": "0",
"roles": [
"dc_vendor"
],
"allcaps": {
"read": true,
"manage_product": true,
"edit_posts": true,
"delete_posts": false,
"view_woocommerce_reports": true,
"assign_product_terms": true,
"upload_files": true,
"read_product": true,
"read_shop_coupon": true,
"edit_product": true,
"delete_product": true,
"edit_products": true,
"delete_products": true,
"publish_products": true,
"edit_published_products": true,
"delete_published_products": true,
"edit_shop_coupon": true,
"edit_shop_coupons": true,
"delete_shop_coupon": true,
"delete_shop_coupons": true,
"publish_shop_coupons": true,
"edit_published_shop_coupons": true,
"delete_published_shop_coupons": true,
"vendor_import_capability": true,
"vendor_export_capability": true,
"dc_vendor": true
},
"timezone_string": "",
"gmt_offset": "",
"shop": {
"url": "http://example.com/vendor/ria/",
"title": "ria",
"slug": "ria",
"description": "",
"image": "",
"banner": ""
},
"address": {
"address_1": "",
"address_2": "",
"city": "",
"state": "",
"country": "",
"postcode": "",
"phone": ""
},
"social": {
"facebook": "",
"twitter": "",
"google_plus": "",
"linkdin": "",
"youtube": "",
"instagram": ""
},
"payment": {
"payment_mode": "",
"bank_account_type": "",
"bank_name": "",
"bank_account_number": "",
"bank_address": "",
"account_holder_name": "",
"aba_routing_number": "",
"destination_currency": "",
"iban": "",
"paypal_email": ""
},
"message_to_buyers": "",
"review": 0,
"_links": {
"self": [
{
"href": "http://example.com/wp-json/mvx/v1/vendors/19"
}
],
"collection": [
{
"href": "http://example.com/wp-json/mvx/v1/vendors"
}
]
}
}
]
Debugging
Error Code | Debugging |
---|---|
400 mvx_rest_is_not_a_dc_vendor |
A resource id entered does not match with the registered vendors |
Update a Vendor
Alter and save vendor's details by calling the MultiVendorX vendors API and using the PUT
method.
/wp-json/mvx/v1/vendors/[id]
curl -X PUT https://example.com/wp-json/mvx/v1/vendors/19 \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"url": "https://wc-marketplace.com",
"message_to_buyers": "Changing values using PUT method",
"address": {
"address_1": "1 ABC Lane",
"address_2": "Example Street",
"city": "New York City",
"state": "New York",
"country": "NY",
"postcode": "1234",
"phone": "11111111"
},
}'
Response:
{
"id": 19,
"login": "ria",
"first_name": "",
"last_name": "",
"nice_name": "ria",
"display_name": "ria",
"email": "",
"url": "https://wc-marketplace.com",
"registered": "2018-06-27 06:17:18",
"status": "0",
"roles": [
"dc_vendor"
],
"allcaps": {
"read": true,
"manage_product": true,
"edit_posts": true,
"delete_posts": false,
"view_woocommerce_reports": true,
"assign_product_terms": true,
"upload_files": true,
"read_product": true,
"read_shop_coupon": true,
"edit_product": true,
"delete_product": true,
"edit_products": true,
"delete_products": true,
"publish_products": true,
"edit_published_products": true,
"delete_published_products": true,
"edit_shop_coupon": true,
"edit_shop_coupons": true,
"delete_shop_coupon": true,
"delete_shop_coupons": true,
"publish_shop_coupons": true,
"edit_published_shop_coupons": true,
"delete_published_shop_coupons": true,
"vendor_import_capability": true,
"vendor_export_capability": true,
"dc_vendor": true
},
"timezone_string": "",
"gmt_offset": "",
"shop": {
"url": "http://example.com/vendor/ria/",
"title": "ria",
"slug": "ria",
"description": "",
"image": "",
"banner": ""
},
"address": {
"address_1": "1 ABC Lane",
"address_2": "Example Street",
"city": "New York City",
"state": "New York",
"country": "NY",
"postcode": "1234",
"phone": "11111111"
},
"social": {
"facebook": "",
"twitter": "",
"google_plus": "",
"linkdin": "",
"youtube": "",
"instagram": ""
},
"payment": {
"payment_mode": "",
"bank_account_type": "",
"bank_name": "",
"bank_account_number": "",
"bank_address": "",
"account_holder_name": "",
"aba_routing_number": "",
"destination_currency": "",
"iban": "",
"paypal_email": ""
},
"message_to_buyers": "Changing values using PUT method",
"review": 0,
"_links": {
"self": [
{
"href": "http://example.com/wp-json/mvx/v1/vendors/19"
}
],
"collection": [
{
"href": "http://example.com/wp-json/mvx/v1/vendors"
}
]
}
}
Debugging
Error Code | Debugging |
---|---|
400 mvx_rest_dc_vendor_insufficient_param |
A resource id is invalid or have not been entered |
400 mvx_rest_is_not_a_dc_vendor |
A resource id entered does not match with the registered vendors |
Delete a Vendor
Remove a vendor by calling the MultiVendorX vendors API and using the DELETE
method.
/wp-json/mvx/v1/vendors/[id]
curl -X DELETE https://example.com/wp-json/mvx/v1/vendors/19 \
-u consumer_key:consumer_secret'
Response:
{
"deleted": true,
"previous": {
"id": 19,
"login": "ria",
"first_name": "",
"last_name": "",
"nice_name": "ria",
"display_name": "ria",
"email": "",
"url": "https://wc-marketplace.com",
"registered": "2018-06-27 06:17:18",
"status": "0",
"roles": [
"dc_vendor"
],
"allcaps": {
"read": true,
"manage_product": true,
"edit_posts": true,
"delete_posts": false,
"view_woocommerce_reports": true,
"assign_product_terms": true,
"upload_files": true,
"read_product": true,
"read_shop_coupon": true,
"edit_product": true,
"delete_product": true,
"edit_products": true,
"delete_products": true,
"publish_products": true,
"edit_published_products": true,
"delete_published_products": true,
"edit_shop_coupon": true,
"edit_shop_coupons": true,
"delete_shop_coupon": true,
"delete_shop_coupons": true,
"publish_shop_coupons": true,
"edit_published_shop_coupons": true,
"delete_published_shop_coupons": true,
"vendor_import_capability": true,
"vendor_export_capability": true,
"dc_vendor": true
},
"timezone_string": "",
"gmt_offset": "",
"shop": {
"url": "http://example.com/vendor/ria/",
"title": "ria",
"slug": "ria",
"description": "",
"image": "",
"banner": ""
},
"address": {
"address_1": "1 ABC Lane",
"address_2": "Example Street",
"city": "New York City",
"state": "New York",
"country": "NY",
"postcode": "1234",
"phone": "11111111"
},
"social": {
"facebook": "",
"twitter": "",
"google_plus": "",
"linkdin": "",
"youtube": "",
"instagram": ""
},
"payment": {
"payment_mode": "",
"bank_account_type": "",
"bank_name": "",
"bank_account_number": "",
"bank_address": "",
"account_holder_name": "",
"aba_routing_number": "",
"destination_currency": "",
"iban": "",
"paypal_email": ""
},
"message_to_buyers": "Changing values using PUT method",
"review": 0
}
}
Debugging
Error Code | Debugging |
---|---|
400 mvx_rest_dc_vendor_insufficient_param |
A resource id is invalid or have not been entered |
400 mvx_rest_is_not_a_dc_vendor |
A resource id entered does not match with the registered vendors |
Batch update Vendors
Using this API with POST
helps you to batch create, update and delete multiple vendors.
/wp-json/mvx/v1/vendors/batch
curl -X POST https://example.com/wp-json/mvx/v21/vendors/batch \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"create": [
{
"email": "john.doe2@example.com",
"first_name": "John",
"last_name": "Doe",
"login": "john.doe2",
"address": {
"address_1": "2 XYZ Lane",
"address_2": "Example Street",
"city": "New York City",
"state": "New York",
"country": "NY",
"postcode": "9876",
"phone": "9999999"
},
"social": {
"facebook": "https:facebook.com",
}
},
{
"email": "joan.francis@example.com",
"first_name": "Joãn",
"last_name": "Francis",
"login": "joan.francis",
"message_to_buyers": "Add this messgae for buyers to see",
}
],
"update": [
{
"id": 16,
"url": "https://dualcube.com"
}
],
"delete": [
17
]
}'
Response:
{
"create": [
{
"id": 20,
"login": "john.doe2",
"first_name": "John",
"last_name": "Doe",
"nice_name": "john-doe2",
"display_name": "John Doe",
"email": "john.doe2@example.com",
"url": "",
"registered": "2018-06-27 10:13:20",
"status": "0",
"roles": [
"dc_vendor"
],
"allcaps": {
"read": true,
"manage_product": true,
"edit_posts": true,
"delete_posts": false,
"view_woocommerce_reports": true,
"assign_product_terms": true,
"upload_files": true,
"read_product": true,
"read_shop_coupon": true,
"edit_product": true,
"delete_product": true,
"edit_products": true,
"delete_products": true,
"publish_products": true,
"edit_published_products": true,
"delete_published_products": true,
"edit_shop_coupon": true,
"edit_shop_coupons": true,
"delete_shop_coupon": true,
"delete_shop_coupons": true,
"publish_shop_coupons": true,
"edit_published_shop_coupons": true,
"delete_published_shop_coupons": true,
"vendor_import_capability": true,
"vendor_export_capability": true,
"dc_vendor": true
},
"timezone_string": "",
"gmt_offset": "",
"shop": {
"url": "http://localhost/v3/vendor/john-doe2/",
"title": "john.doe2",
"slug": "john-doe2",
"description": "",
"image": "",
"banner": ""
},
"address": {
"address_1": "2 XYZ Lane",
"address_2": "Example Street",
"city": "New York City",
"state": "New York",
"country": "NY",
"postcode": "9876",
"phone": "9999999"
},
"social": {
"facebook": "https:facebook.com",
"twitter": "",
"google_plus": "",
"linkdin": "",
"youtube": "",
"instagram": ""
},
"payment": {
"payment_mode": "",
"bank_account_type": "",
"bank_name": "",
"bank_account_number": "",
"bank_address": "",
"account_holder_name": "",
"aba_routing_number": "",
"destination_currency": "",
"iban": "",
"paypal_email": ""
},
"message_to_buyers": "",
"review": 0,
"_links": {
"self": [
{
"href": "http://localhost/v3/wp-json/mvx/v1/vendors/20"
}
],
"collection": [
{
"href": "http://localhost/v3/wp-json/mvx/v1/vendors"
}
]
}
},
{
"id": 21,
"login": "joan.francis",
"first_name": "Joãn",
"last_name": "Francis",
"nice_name": "joan-francis",
"display_name": "Joãn Francis",
"email": "joan.francis@example.com",
"url": "",
"registered": "2018-06-27 10:13:21",
"status": "0",
"roles": [
"dc_vendor"
],
"allcaps": {
"read": true,
"manage_product": true,
"edit_posts": true,
"delete_posts": false,
"view_woocommerce_reports": true,
"assign_product_terms": true,
"upload_files": true,
"read_product": true,
"read_shop_coupon": true,
"edit_product": true,
"delete_product": true,
"edit_products": true,
"delete_products": true,
"publish_products": true,
"edit_published_products": true,
"delete_published_products": true,
"edit_shop_coupon": true,
"edit_shop_coupons": true,
"delete_shop_coupon": true,
"delete_shop_coupons": true,
"publish_shop_coupons": true,
"edit_published_shop_coupons": true,
"delete_published_shop_coupons": true,
"vendor_import_capability": true,
"vendor_export_capability": true,
"dc_vendor": true
},
"timezone_string": "",
"gmt_offset": "",
"shop": {
"url": "http://localhost/v3/vendor/joan-francis/",
"title": "joan.francis",
"slug": "joan-francis",
"description": "",
"image": "",
"banner": ""
},
"address": {
"address_1": "",
"address_2": "",
"city": "",
"state": "",
"country": "",
"postcode": "",
"phone": ""
},
"social": {
"facebook": "",
"twitter": "",
"google_plus": "",
"linkdin": "",
"youtube": "",
"instagram": ""
},
"payment": {
"payment_mode": "",
"bank_account_type": "",
"bank_name": "",
"bank_account_number": "",
"bank_address": "",
"account_holder_name": "",
"aba_routing_number": "",
"destination_currency": "",
"iban": "",
"paypal_email": ""
},
"message_to_buyers": "Add this messgae for buyers to see",
"review": 0,
"_links": {
"self": [
{
"href": "http://localhost/v3/wp-json/mvx/v1/vendors/21"
}
],
"collection": [
{
"href": "http://localhost/v3/wp-json/mvx/v1/vendors"
}
]
}
}
],
"update": [
{
"id": 16,
"login": "raina",
"first_name": "",
"last_name": "",
"nice_name": "raina",
"display_name": "raina",
"email": "",
"url": "https://dualcube.com",
"registered": "2018-06-26 07:40:10",
"status": "0",
"roles": [
"dc_vendor"
],
"allcaps": {
"read": true,
"manage_product": true,
"edit_posts": true,
"delete_posts": false,
"view_woocommerce_reports": true,
"assign_product_terms": true,
"upload_files": true,
"read_product": true,
"read_shop_coupon": true,
"edit_product": true,
"delete_product": true,
"edit_products": true,
"delete_products": true,
"publish_products": true,
"edit_published_products": true,
"delete_published_products": true,
"edit_shop_coupon": true,
"edit_shop_coupons": true,
"delete_shop_coupon": true,
"delete_shop_coupons": true,
"publish_shop_coupons": true,
"edit_published_shop_coupons": true,
"delete_published_shop_coupons": true,
"vendor_import_capability": true,
"vendor_export_capability": true,
"dc_vendor": true
},
"timezone_string": "",
"gmt_offset": "",
"shop": {
"url": "http://localhost/v3/vendor/raina/",
"title": "raina",
"slug": "raina",
"description": "",
"image": "",
"banner": ""
},
"address": {
"address_1": "56 Mounthoolie Lane",
"address_2": "",
"city": "SUTTON BASSETT",
"state": "Northamptonshire",
"country": "GB",
"postcode": "LE16 7EL",
"phone": "917-729-7017"
},
"social": {
"facebook": "",
"twitter": "",
"google_plus": "",
"linkdin": "",
"youtube": "",
"instagram": ""
},
"payment": {
"payment_mode": "",
"bank_account_type": "",
"bank_name": "",
"bank_account_number": "",
"bank_address": "",
"account_holder_name": "",
"aba_routing_number": "",
"destination_currency": "",
"iban": "",
"paypal_email": ""
},
"message_to_buyers": "",
"review": 0,
"_links": {
"self": [
{
"href": "http://localhost/v3/wp-json/mvx/v1/vendors/16"
}
],
"collection": [
{
"href": "http://localhost/v3/wp-json/mvx/v1/vendors"
}
]
}
}
],
"delete": [
{
"deleted": true,
"previous": {
"id": 17,
"login": "james",
"first_name": "James",
"last_name": "Goody",
"nice_name": "james",
"display_name": "Jaina",
"email": "james@example.com",
"url": "https://example.com",
"registered": "2018-06-26 07:47:23",
"status": "0",
"roles": [
"dc_vendor"
],
"allcaps": {
"read": true,
"manage_product": true,
"edit_posts": true,
"delete_posts": false,
"view_woocommerce_reports": true,
"assign_product_terms": true,
"upload_files": true,
"read_product": true,
"read_shop_coupon": true,
"edit_product": true,
"delete_product": true,
"edit_products": true,
"delete_products": true,
"publish_products": true,
"edit_published_products": true,
"delete_published_products": true,
"edit_shop_coupon": true,
"edit_shop_coupons": true,
"delete_shop_coupon": true,
"delete_shop_coupons": true,
"publish_shop_coupons": true,
"edit_published_shop_coupons": true,
"delete_published_shop_coupons": true,
"vendor_import_capability": true,
"vendor_export_capability": true,
"dc_vendor": true
},
"timezone_string": "",
"gmt_offset": "",
"shop": {
"url": "http://localhost/v3/vendor/james/",
"title": "james",
"slug": "james",
"description": "",
"image": "",
"banner": ""
},
"address": {
"address_1": "56 Mounthoolie Lane",
"address_2": "",
"city": "SUTTON BASSETT",
"state": "Northamptonshire",
"country": "GB",
"postcode": "LE16 7EL",
"phone": "917-729-7017"
},
"social": {
"facebook": "",
"twitter": "",
"google_plus": "",
"linkdin": "",
"youtube": "",
"instagram": ""
},
"payment": {
"payment_mode": "",
"bank_account_type": "",
"bank_name": "",
"bank_account_number": "",
"bank_address": "",
"account_holder_name": "",
"aba_routing_number": "",
"destination_currency": "",
"iban": "",
"paypal_email": ""
},
"message_to_buyers": "",
"review": 0
}
}
]
}
Products
MultiVendorX Products API allows you to get all the products of a vendor or insert a vendor's product and even update a product with a vendor assigned to it (extends WooCommerce Products API).
List all products by vendor
To retrieve all the products by a vendor, make a HTTP GET request to WooCommerce's Product API with a vendor
parameter passed to it.
Accepted Parameters
Attribute | Description |
---|---|
vendor |
Vendor ID of the vendor whose products are to be listed. |
include_vendor |
Array of vendor IDs whose products are to be listed. |
exclude_vendor |
Array of vendor IDs whose products are to be excluded from the list. |
HTTP request
/wp-json/wc/v2/products/?vendor=[vendor_id]
curl -X GET https://example.com/wp-json/wc/v2/products?vendor=13 \
-u consumer_key:consumer_secret
Response:
[
{
"id": 484,
"name": "abc",
"slug": "",
"permalink": "http://example.com/?post_type=product&p=484",
"date_created": "2018-06-27T11:45:45",
"date_created_gmt": "2018-06-27T11:45:45",
"date_modified": "2018-06-27T11:45:49",
"date_modified_gmt": "2018-06-27T11:45:49",
"type": "simple",
"status": "draft",
"featured": false,
"catalog_visibility": "visible",
"description": "",
"short_description": "",
"sku": "",
"price": "",
"regular_price": "",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_from_gmt": null,
"date_on_sale_to": null,
"date_on_sale_to_gmt": null,
"price_html": "",
"on_sale": false,
"purchasable": false,
"total_sales": 0,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"in_stock": true,
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"sold_individually": false,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_required": true,
"shipping_taxable": true,
"shipping_class": "debleena5-13",
"shipping_class_id": 85,
"reviews_allowed": true,
"average_rating": "0.00",
"rating_count": 0,
"related_ids": [
435,
418,
479
],
"upsell_ids": [],
"cross_sell_ids": [],
"parent_id": 479,
"purchase_note": "",
"categories": [
{
"id": 64,
"name": "Uncategorised",
"slug": "uncategorised"
}
],
"tags": [],
"images": [
{
"id": 0,
"date_created": "2018-06-27T12:39:30",
"date_created_gmt": "2018-06-27T12:39:30",
"date_modified": "2018-06-27T12:39:30",
"date_modified_gmt": "2018-06-27T12:39:30",
"src": "http://example.com/wp-content/plugins/woocommerce/assets/images/placeholder.png",
"name": "Placeholder",
"alt": "Placeholder",
"position": 0
}
],
"attributes": [],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 0,
"meta_data": [
{
"id": 11366,
"key": "_mvx_child_product",
"value": "1"
}
],
"vendor": "13",
"_links": {
"self": [
{
"href": "http://example.com/wp-json/wc/v2/products/484"
}
],
"collection": [
{
"href": "http://example.com/wp-json/wc/v2/products"
}
],
"up": [
{
"href": "http://example.com/wp-json/wc/v2/products/479"
}
]
}
},
{
"id": 483,
"name": "abc",
"slug": "",
"permalink": "http://example.com/?post_type=product&p=483",
"date_created": "2018-06-27T10:55:19",
"date_created_gmt": "2018-06-27T10:55:19",
"date_modified": "2018-06-27T10:55:23",
"date_modified_gmt": "2018-06-27T10:55:23",
"type": "simple",
"status": "draft",
"featured": false,
"catalog_visibility": "visible",
"description": "",
"short_description": "",
"sku": "",
"price": "",
"regular_price": "",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_from_gmt": null,
"date_on_sale_to": null,
"date_on_sale_to_gmt": null,
"price_html": "",
"on_sale": false,
"purchasable": false,
"total_sales": 0,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"in_stock": true,
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"sold_individually": false,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_required": true,
"shipping_taxable": true,
"shipping_class": "debleena5-13",
"shipping_class_id": 85,
"reviews_allowed": true,
"average_rating": "0.00",
"rating_count": 0,
"related_ids": [
479,
418,
435
],
"upsell_ids": [],
"cross_sell_ids": [],
"parent_id": 479,
"purchase_note": "",
"categories": [
{
"id": 64,
"name": "Uncategorised",
"slug": "uncategorised"
}
],
"tags": [],
"images": [
{
"id": 0,
"date_created": "2018-06-27T12:39:30",
"date_created_gmt": "2018-06-27T12:39:30",
"date_modified": "2018-06-27T12:39:30",
"date_modified_gmt": "2018-06-27T12:39:30",
"src": "http://example.com/wp-content/plugins/woocommerce/assets/images/placeholder.png",
"name": "Placeholder",
"alt": "Placeholder",
"position": 0
}
],
"attributes": [],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 0,
"meta_data": [
{
"id": 11332,
"key": "_mvx_child_product",
"value": "1"
}
],
"vendor": "13",
"_links": {
"self": [
{
"href": "http://example.com/wp-json/wc/v2/products/483"
}
],
"collection": [
{
"href": "http://example.com/wp-json/wc/v2/products"
}
],
"up": [
{
"href": "http://example.com/wp-json/wc/v2/products/479"
}
]
}
}
]
List a specific product by a vendor
Using this you can list a single product of a specific vendor.
HTTP request
/wp-json/wc/v2/products/[product_id]?vendor=[vendor_id]
curl -X POST https://example.com/wp-json/wc/v2/products/485/?vendor=13 \
-u consumer_key:consumer_secret
Response:
Response data received is same as above except for the fact, only the specific product is retrieved.
Create a vendor's product
Using this you can add a product to a vendor.
HTTP request
/wp-json/wc/v2/products/
curl -X POST https://example.com/wp-json/wc/v2/products \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"name": "Premium Quality",
"type": "simple",
"regular_price": "21.99",
"description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",
"short_description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.",
"images": [
{
"src": "http://example.com/wp-content/uploads/sites/56/2013/06/T_2_front.jpg",
"position": 0
},
{
"src": "http://example.com/wp-content/uploads/sites/56/2013/06/T_2_back.jpg",
"position": 1
}
],
"vendor": 13
}'
Debugging
Error Code | Debugging |
---|---|
404 woocommerce_rest_product_invalid_vendor_id |
Provided id does not belong to a registered vendor. Enter a valid vendor ID. |
Assign a new vendor to a product
Update your existing product with a new vendor or assign a vendor to an existing vendor-less product.
HTTP request
/wp-json/wc/v2/products/[product_id]/
curl -X POST https://example.com/wp-json/wc/v2/products/485 \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"vendor": 14
}'
Response:
{
"id": 485,
"name": "Pro 3",
"slug": "pro-3",
"permalink": "http://example.com/product/pro-3/",
"date_created": "2018-06-27T12:15:35",
"date_created_gmt": "2018-06-27T12:15:35",
"date_modified": "2018-06-28T05:31:06",
"date_modified_gmt": "2018-06-28T05:31:06",
"type": "simple",
"status": "publish",
"featured": false,
"catalog_visibility": "visible",
"description": "",
"short_description": "",
"sku": "",
"price": "100",
"regular_price": "100",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_from_gmt": null,
"date_on_sale_to": null,
"date_on_sale_to_gmt": null,
"price_html": "<span class=\"woocommerce-Price-amount amount\"><span class=\"woocommerce-Price-currencySymbol\">$</span>90.91</span>",
"on_sale": false,
"purchasable": true,
"total_sales": 0,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"in_stock": true,
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"sold_individually": false,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_required": true,
"shipping_taxable": true,
"shipping_class": "",
"shipping_class_id": 0,
"reviews_allowed": true,
"average_rating": "0",
"rating_count": 0,
"related_ids": [
439,
422
],
"upsell_ids": [],
"cross_sell_ids": [],
"parent_id": 0,
"purchase_note": "",
"categories": [
{
"id": 64,
"name": "Uncategorised",
"slug": "uncategorised"
}
],
"tags": [],
"images": [
{
"id": 0,
"date_created": "2018-06-28T05:31:07",
"date_created_gmt": "2018-06-28T05:31:07",
"date_modified": "2018-06-28T05:31:07",
"date_modified_gmt": "2018-06-28T05:31:07",
"src": "http://example.com/wp-content/plugins/woocommerce/assets/images/placeholder.png",
"name": "Placeholder",
"alt": "Placeholder",
"position": 0
}
],
"attributes": [],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 0,
"meta_data": [
{
"id": 11400,
"key": "_commission_per_product",
"value": ""
},
{
"id": 11401,
"key": "_mvx_cancallation_policy",
"value": ""
},
{
"id": 11402,
"key": "_mvx_refund_policy",
"value": ""
},
{
"id": 11403,
"key": "_mvx_shipping_policy",
"value": ""
}
],
"vendor": "14",
"_links": {
"self": [
{
"href": "http://example.com/wp-json/wc/v2/products/485"
}
],
"collection": [
{
"href": "http://example.com/wp-json/wc/v2/products"
}
]
}
}
# Orders # MultiVendorX Orders API allows you to list all the orders of a vendor (extends WooCommerce Orders API).
List all orders by vendor
To retrieve all the orders by a vendor, make a HTTP GET request to WooCommerce's Orders API with a vendor
parameter passed to it.
Accepted Parameters
Attribute | Description |
---|---|
vendor |
Vendor ID of the vendor whose orders are to be listed. |
include_vendor |
Array of vendor IDs whose orders are to be listed. |
exclude_vendor |
Array of vendor IDs whose orders are to be excluded from the list. |
HTTP request
/wp-json/wc/v2/orders/?vendor=[vendor_id]
curl -X GET https://example.com/wp-json/wc/v2/orders?vendor=13 \
-u consumer_key:consumer_secret
Response:
[
{
"id": 480,
"parent_id": 0,
"number": "480",
"order_key": "wc_order_5b32210b5888a",
"created_via": "checkout",
"version": "3.4.2",
"status": "processing",
"currency": "USD",
"date_created": "2018-06-26T11:18:35",
"date_created_gmt": "2018-06-26T11:18:35",
"date_modified": "2018-06-26T11:18:39",
"date_modified_gmt": "2018-06-26T11:18:39",
"discount_total": "0.00",
"discount_tax": "0.00",
"shipping_total": "0.00",
"shipping_tax": "0.00",
"cart_tax": "9.09",
"total": "100.00",
"total_tax": "9.09",
"prices_include_tax": true,
"customer_id": 18,
"customer_ip_address": "::1",
"customer_user_agent": "mozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml, like gecko) ubuntu chromium/62.0.3202.75 chrome/62.0.3202.75 safari/537.36",
"customer_note": "",
"billing": {
"first_name": "Customer",
"last_name": "Test",
"company": "",
"address_1": "1, Happy Street",
"address_2": "",
"city": "New York City",
"state": "CA",
"postcode": "10001",
"country": "US",
"email": "test@hm.com",
"phone": "9876543210"
},
"shipping": {
"first_name": "Customer",
"last_name": "Test",
"company": "",
"address_1": "1, Happy Street",
"address_2": "",
"city": "New York City",
"state": "CA",
"postcode": "10001",
"country": "US"
},
"payment_method": "cod",
"payment_method_title": "Cash on delivery",
"transaction_id": "",
"date_paid": null,
"date_paid_gmt": null,
"date_completed": null,
"date_completed_gmt": null,
"cart_hash": "d16e86a2720e474fde669e38611608a3",
"meta_data": [
{
"id": 11251,
"key": "_mvx_order_processed",
"value": "1"
},
{
"id": 11261,
"key": "_commission_ids",
"value": [
481
]
},
{
"id": 11262,
"key": "_commissions_processed",
"value": "yes"
}
],
"line_items": [
{
"id": 101,
"name": "Pro 1",
"product_id": 418,
"variation_id": 0,
"quantity": 1,
"tax_class": "",
"subtotal": "90.91",
"subtotal_tax": "9.09",
"total": "90.91",
"total_tax": "9.09",
"taxes": [
{
"id": 1,
"total": "9.090909",
"subtotal": "9.090909"
}
],
"meta_data": [
{
"id": 857,
"key": "Sold By",
"value": "debleena5"
},
{
"id": 858,
"key": "_vendor_id",
"value": "13"
}
],
"sku": "pro-001",
"price": 90.909091
}
],
"tax_lines": [
{
"id": 103,
"rate_code": "TAX-1",
"rate_id": 1,
"label": "Tax",
"compound": false,
"tax_total": "9.09",
"shipping_tax_total": "0.00",
"meta_data": []
}
],
"shipping_lines": [
{
"id": 102,
"method_title": "Flat rate",
"method_id": "flat_rate",
"instance_id": "3",
"total": "0.00",
"total_tax": "0.00",
"taxes": [],
"meta_data": [
{
"id": 864,
"key": "Items",
"value": "Pro 1 × 1"
},
{
"id": 865,
"key": "vendor_id",
"value": "13"
},
{
"id": 866,
"key": "package_qty",
"value": "1"
}
]
}
],
"fee_lines": [],
"coupon_lines": [],
"refunds": [],
"_links": {
"self": [
{
"href": "http://example.com/wp-json/wc/v2/orders/480"
}
],
"collection": [
{
"href": "http://example.com/wp-json/wc/v2/orders"
}
],
"customer": [
{
"href": "http://example.com/wp-json/wc/v2/customers/18"
}
]
}
},
{
"id": 464,
"parent_id": 0,
"number": "464",
"order_key": "wc_order_5b2232bfaf898",
"created_via": "checkout",
"version": "3.4.2",
"status": "on-hold",
"currency": "USD",
"date_created": "2018-06-14T09:17:51",
"date_created_gmt": "2018-06-14T09:17:51",
"date_modified": "2018-06-14T09:17:55",
"date_modified_gmt": "2018-06-14T09:17:55",
"discount_total": "0.00",
"discount_tax": "0.00",
"shipping_total": "0.00",
"shipping_tax": "0.00",
"cart_tax": "9.09",
"total": "100.00",
"total_tax": "9.09",
"prices_include_tax": true,
"customer_id": 5,
"customer_ip_address": "127.0.0.1",
"customer_user_agent": "mozilla/5.0 (x11; ubuntu; linux x86_64; rv:56.0) gecko/20100101 firefox/56.0",
"customer_note": "",
"billing": {
"first_name": "Jimmy",
"last_name": "Parker",
"company": "ABC Text",
"address_1": "Thatcham Business Village, Colthrop Way",
"address_2": "",
"city": "Thatcham",
"state": "England",
"postcode": "RG19 4LW",
"country": "GB",
"email": "customer@fm.cm",
"phone": "987654670"
},
"shipping": {
"first_name": "Jimmy",
"last_name": "Parker",
"company": "ABC Text",
"address_1": "Thatcham Business Village, Colthrop Way",
"address_2": "",
"city": "Thatcham",
"state": "England",
"postcode": "RG19 4LW",
"country": "GB"
},
"payment_method": "bacs",
"payment_method_title": "Direct bank transfer",
"transaction_id": "",
"date_paid": null,
"date_paid_gmt": null,
"date_completed": null,
"date_completed_gmt": null,
"cart_hash": "d16e86a2720e474fde669e38611608a3",
"meta_data": [
{
"id": 10938,
"key": "_mvx_order_processed",
"value": "1"
}
],
"line_items": [
{
"id": 80,
"name": "Pro 1",
"product_id": 418,
"variation_id": 0,
"quantity": 1,
"tax_class": "",
"subtotal": "90.91",
"subtotal_tax": "9.09",
"total": "90.91",
"total_tax": "9.09",
"taxes": [
{
"id": 1,
"total": "9.090909",
"subtotal": "9.090909"
}
],
"meta_data": [
{
"id": 699,
"key": "Sold By",
"value": "debleena5"
},
{
"id": 700,
"key": "_vendor_id",
"value": "13"
}
],
"sku": "pro-001",
"price": 90.909091
}
],
"tax_lines": [
{
"id": 82,
"rate_code": "TAX-1",
"rate_id": 1,
"label": "Tax",
"compound": false,
"tax_total": "9.09",
"shipping_tax_total": "0.00",
"meta_data": []
}
],
"shipping_lines": [
{
"id": 81,
"method_title": "Free shipping",
"method_id": "free_shipping",
"instance_id": "1",
"total": "0.00",
"total_tax": "0.00",
"taxes": [],
"meta_data": [
{
"id": 706,
"key": "Items",
"value": "Pro 1 × 1"
},
{
"id": 707,
"key": "vendor_id",
"value": "13"
},
{
"id": 708,
"key": "package_qty",
"value": "1"
}
]
}
],
"fee_lines": [],
"coupon_lines": [],
"refunds": [],
"_links": {
"self": [
{
"href": "http://example.com/wp-json/wc/v2/orders/464"
}
],
"collection": [
{
"href": "http://example.com/wp-json/wc/v2/orders"
}
],
"customer": [
{
"href": "http://example.com/wp-json/wc/v2/customers/5"
}
]
}
}
]
List a specific order by a vendor
Using this you can list a single order of a specific vendor.
HTTP request
/wp-json/wc/v2/orders/[order_id]?vendor=[vendor_id]
curl -X POST https://example.com/wp-json/wc/v2/orders/485/?vendor=13 \
-u consumer_key:consumer_secret
Response:
Response data received is same as above except for the fact, only the specific order is retrieved.
Coupons
MultiVendorX Coupons API allows you to get all the coupons of a vendor or insert a vendor's coupon and even update a coupon with a vendor assigned to it WordPress REST API and (extends WooCommerce Coupons API).
List all coupons by vendor
To retrieve all the coupons by a vendor, make a HTTP GET request to WooCommerce's Coupon API with a vendor
parameter passed to it.
Accepted Parameters
Attribute | Description |
---|---|
vendor |
Vendor ID of the vendor whose coupons are to be listed. |
include_vendor |
Array of vendor IDs whose coupons are to be listed. |
exclude_vendor |
Array of vendor IDs whose coupons are to be excluded from the list. |
HTTP request
/wp-json/wc/v2/coupons/?vendor=[vendor_id]
curl -X POST https://example.com/wp-json/wc/v2/coupons/?vendor=13 \
-u consumer_key:consumer_secret
Response:
[
{
"id": 490,
"code": "50off",
"amount": "50.00",
"date_created": "2018-06-28T06:20:39",
"date_created_gmt": "2018-06-28T06:20:39",
"date_modified": "2018-06-28T06:20:39",
"date_modified_gmt": "2018-06-28T06:20:39",
"discount_type": "fixed_product",
"description": "Curabitur molestie posuere purus, eget venenatis quam ornare quis. Aenean pharetra magna quam, ac efficitur sapien ornare sed. Sed in lobortis nisi. ",
"date_expires": "2018-08-29T00:00:00",
"date_expires_gmt": "2018-08-29T00:00:00",
"usage_count": 0,
"individual_use": true,
"product_ids": [],
"excluded_product_ids": [],
"usage_limit": null,
"usage_limit_per_user": 2,
"limit_usage_to_x_items": null,
"free_shipping": false,
"product_categories": [],
"excluded_product_categories": [],
"exclude_sale_items": true,
"minimum_amount": "500.00",
"maximum_amount": "0.00",
"email_restrictions": [],
"used_by": [],
"meta_data": [],
"vendor": "13",
"_links": {
"self": [
{
"href": "http://example.com/wp-json/wc/v2/coupons/490"
}
],
"collection": [
{
"href": "http://example.com/wp-json/wc/v2/coupons"
}
]
}
},
{
"id": 489,
"code": "mvx coupon",
"amount": "10.00",
"date_created": "2018-06-28T06:18:49",
"date_created_gmt": "2018-06-28T06:18:49",
"date_modified": "2018-06-28T06:18:49",
"date_modified_gmt": "2018-06-28T06:18:49",
"discount_type": "fixed_product",
"description": "Curabitur molestie posuere purus, eget venenatis quam ornare quis. Aenean pharetra magna quam, ac efficitur sapien ornare sed. Sed in lobortis nisi. ",
"date_expires": "2018-07-13T00:00:00",
"date_expires_gmt": "2018-07-13T00:00:00",
"usage_count": 0,
"individual_use": true,
"product_ids": [],
"excluded_product_ids": [],
"usage_limit": null,
"usage_limit_per_user": 1,
"limit_usage_to_x_items": null,
"free_shipping": false,
"product_categories": [],
"excluded_product_categories": [],
"exclude_sale_items": true,
"minimum_amount": "150.00",
"maximum_amount": "0.00",
"email_restrictions": [],
"used_by": [],
"meta_data": [],
"vendor": "13",
"_links": {
"self": [
{
"href": "http://example.com/wp-json/wc/v2/coupons/489"
}
],
"collection": [
{
"href": "http://example.com/wp-json/wc/v2/coupons"
}
]
}
}
]
List a specific coupon by a vendor
Using this you can list a single coupon of a specific vendor.
HTTP request
/wp-json/wc/v2/coupons/[coupon_id]?vendor=[vendor_id]
curl -X GET https://example.com/wp-json/wc/v2/coupons/485/?vendor=13 \
-u consumer_key:consumer_secret
Response:
Response data received is same as above except for the fact, only the specific coupon is retrieved.
Create a vendor's coupon
Using this you can add a coupon to a vendor.
HTTP request
/wp-json/wc/v2/coupons/
curl -X POST https://example.com/wp-json/wc/v2/coupons \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"code": "50off",
"discount_type": "fixed_product",
"amount": "50",
"individual_use": true,
"exclude_sale_items": true,
"minimum_amount": "500.00",
"vendor": 13
}'
Debugging
Error Code | Debugging |
---|---|
404 woocommerce_rest_shop_coupon_invalid_vendor_id |
Provided id does not belong to a registered vendor. Enter a valid vendor ID. |
Assign a new vendor to a coupon
Update your existing coupon with a new vendor or assign a vendor to an existing vendor-less coupon.
HTTP request
/wp-json/wc/v2/coupons/[coupon_id]/
curl -X POST https://example.com/wp-json/wc/v2/coupons/490 \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"vendor": 14
}'
Response:
{
"id": 490,
"code": "50off",
"amount": "50.00",
"date_created": "2018-06-28T06:20:39",
"date_created_gmt": "2018-06-28T06:20:39",
"date_modified": "2018-06-28T06:20:39",
"date_modified_gmt": "2018-06-28T06:20:39",
"discount_type": "fixed_product",
"description": "Curabitur molestie posuere purus, eget venenatis quam ornare quis. Aenean pharetra magna quam, ac efficitur sapien ornare sed. Sed in lobortis nisi. ",
"date_expires": "2018-08-29T00:00:00",
"date_expires_gmt": "2018-08-29T00:00:00",
"usage_count": 0,
"individual_use": true,
"product_ids": [],
"excluded_product_ids": [],
"usage_limit": null,
"usage_limit_per_user": 2,
"limit_usage_to_x_items": null,
"free_shipping": false,
"product_categories": [],
"excluded_product_categories": [],
"exclude_sale_items": true,
"minimum_amount": "500.00",
"maximum_amount": "0.00",
"email_restrictions": [],
"used_by": [],
"meta_data": [],
"vendor": "14",
"_links": {
"self": [
{
"href": "http://example.com/wp-json/wc/v2/coupons/490"
}
],
"collection": [
{
"href": "http://example.com/wp-json/wc/v2/coupons"
}
]
}
}
Vendor Review
MultiVendorX Orders This API request help you retrieve all the vendor's review
Get all reviews from a vendor
list of all the vendors reviews created on your site by calling the MultiVendorX vendors API and using the GET method.
Accepted Parameters
Attribute | Description |
---|---|
vendor_id |
Unique identifier for the vendor |
reviews_list |
The list of vendor review |
rating_count |
The total rating of a vendor |
review_id |
Unique identifier for a review |
HTTP request
/wp-json/wc/v2/orders/?vendor=[vendor_id]
curl -X GET https://example.com/wp-json/wc/v2/orders?vendor=13 \
-u consumer_key:consumer_secret
Response:
[
{
"id": 480,
"parent_id": 0,
"number": "480",
"order_key": "wc_order_5b32210b5888a",
"created_via": "checkout",
"version": "3.4.2",
"status": "processing",
"currency": "USD",
"date_created": "2018-06-26T11:18:35",
"date_created_gmt": "2018-06-26T11:18:35",
"date_modified": "2018-06-26T11:18:39",
"date_modified_gmt": "2018-06-26T11:18:39",
"discount_total": "0.00",
"discount_tax": "0.00",
"shipping_total": "0.00",
"shipping_tax": "0.00",
"cart_tax": "9.09",
"total": "100.00",
"total_tax": "9.09",
"prices_include_tax": true,
"customer_id": 18,
"customer_ip_address": "::1",
"customer_user_agent": "mozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml, like gecko) ubuntu chromium/62.0.3202.75 chrome/62.0.3202.75 safari/537.36",
"customer_note": "",
"billing": {
"first_name": "Customer",
"last_name": "Test",
"company": "",
"address_1": "1, Happy Street",
"address_2": "",
"city": "New York City",
"state": "CA",
"postcode": "10001",
"country": "US",
"email": "test@hm.com",
"phone": "9876543210"
},
"shipping": {
"first_name": "Customer",
"last_name": "Test",
"company": "",
"address_1": "1, Happy Street",
"address_2": "",
"city": "New York City",
"state": "CA",
"postcode": "10001",
"country": "US"
},
"payment_method": "cod",
"payment_method_title": "Cash on delivery",
"transaction_id": "",
"date_paid": null,
"date_paid_gmt": null,
"date_completed": null,
"date_completed_gmt": null,
"cart_hash": "d16e86a2720e474fde669e38611608a3",
"meta_data": [
{
"id": 11251,
"key": "_wcmp_order_processed",
"value": "1"
},
{
"id": 11261,
"key": "_commission_ids",
"value": [
481
]
},
{
"id": 11262,
"key": "_commissions_processed",
"value": "yes"
}
],
"line_items": [
{
"id": 101,
"name": "Pro 1",
"product_id": 418,
"variation_id": 0,
"quantity": 1,
"tax_class": "",
"subtotal": "90.91",
"subtotal_tax": "9.09",
"total": "90.91",
"total_tax": "9.09",
"taxes": [
{
"id": 1,
"total": "9.090909",
"subtotal": "9.090909"
}
],
"meta_data": [
{
"id": 857,
"key": "Sold By",
"value": "debleena5"
},
{
"id": 858,
"key": "_vendor_id",
"value": "13"
}
],
"sku": "pro-001",
"price": 90.909091
}
],
"tax_lines": [
{
"id": 103,
"rate_code": "TAX-1",
"rate_id": 1,
"label": "Tax",
"compound": false,
"tax_total": "9.09",
"shipping_tax_total": "0.00",
"meta_data": []
}
],
"shipping_lines": [
{
"id": 102,
"method_title": "Flat rate",
"method_id": "flat_rate",
"instance_id": "3",
"total": "0.00",
"total_tax": "0.00",
"taxes": [],
"meta_data": [
{
"id": 864,
"key": "Items",
"value": "Pro 1 × 1"
},
{
"id": 865,
"key": "vendor_id",
"value": "13"
},
{
"id": 866,
"key": "package_qty",
"value": "1"
}
]
}
],
"fee_lines": [],
"coupon_lines": [],
"refunds": [],
"_links": {
"self": [
{
"href": "http://example.com/wp-json/wc/v2/orders/480"
}
],
"collection": [
{
"href": "http://example.com/wp-json/wc/v2/orders"
}
],
"customer": [
{
"href": "http://example.com/wp-json/wc/v2/customers/18"
}
]
}
},
{
"id": 464,
"parent_id": 0,
"number": "464",
"order_key": "wc_order_5b2232bfaf898",
"created_via": "checkout",
"version": "3.4.2",
"status": "on-hold",
"currency": "USD",
"date_created": "2018-06-14T09:17:51",
"date_created_gmt": "2018-06-14T09:17:51",
"date_modified": "2018-06-14T09:17:55",
"date_modified_gmt": "2018-06-14T09:17:55",
"discount_total": "0.00",
"discount_tax": "0.00",
"shipping_total": "0.00",
"shipping_tax": "0.00",
"cart_tax": "9.09",
"total": "100.00",
"total_tax": "9.09",
"prices_include_tax": true,
"customer_id": 5,
"customer_ip_address": "127.0.0.1",
"customer_user_agent": "mozilla/5.0 (x11; ubuntu; linux x86_64; rv:56.0) gecko/20100101 firefox/56.0",
"customer_note": "",
"billing": {
"first_name": "Jimmy",
"last_name": "Parker",
"company": "ABC Text",
"address_1": "Thatcham Business Village, Colthrop Way",
"address_2": "",
"city": "Thatcham",
"state": "England",
"postcode": "RG19 4LW",
"country": "GB",
"email": "customer@fm.cm",
"phone": "987654670"
},
"shipping": {
"first_name": "Jimmy",
"last_name": "Parker",
"company": "ABC Text",
"address_1": "Thatcham Business Village, Colthrop Way",
"address_2": "",
"city": "Thatcham",
"state": "England",
"postcode": "RG19 4LW",
"country": "GB"
},
"payment_method": "bacs",
"payment_method_title": "Direct bank transfer",
"transaction_id": "",
"date_paid": null,
"date_paid_gmt": null,
"date_completed": null,
"date_completed_gmt": null,
"cart_hash": "d16e86a2720e474fde669e38611608a3",
"meta_data": [
{
"id": 10938,
"key": "_wcmp_order_processed",
"value": "1"
}
],
"line_items": [
{
"id": 80,
"name": "Pro 1",
"product_id": 418,
"variation_id": 0,
"quantity": 1,
"tax_class": "",
"subtotal": "90.91",
"subtotal_tax": "9.09",
"total": "90.91",
"total_tax": "9.09",
"taxes": [
{
"id": 1,
"total": "9.090909",
"subtotal": "9.090909"
}
],
"meta_data": [
{
"id": 699,
"key": "Sold By",
"value": "debleena5"
},
{
"id": 700,
"key": "_vendor_id",
"value": "13"
}
],
"sku": "pro-001",
"price": 90.909091
}
],
"tax_lines": [
{
"id": 82,
"rate_code": "TAX-1",
"rate_id": 1,
"label": "Tax",
"compound": false,
"tax_total": "9.09",
"shipping_tax_total": "0.00",
"meta_data": []
}
],
"shipping_lines": [
{
"id": 81,
"method_title": "Free shipping",
"method_id": "free_shipping",
"instance_id": "1",
"total": "0.00",
"total_tax": "0.00",
"taxes": [],
"meta_data": [
{
"id": 706,
"key": "Items",
"value": "Pro 1 × 1"
},
{
"id": 707,
"key": "vendor_id",
"value": "13"
},
{
"id": 708,
"key": "package_qty",
"value": "1"
}
]
}
],
"fee_lines": [],
"coupon_lines": [],
"refunds": [],
"_links": {
"self": [
{
"href": "http://example.com/wp-json/wc/v2/orders/464"
}
],
"collection": [
{
"href": "http://example.com/wp-json/wc/v2/orders"
}
],
"customer": [
{
"href": "http://example.com/wp-json/wc/v2/customers/5"
}
]
}
}
]
Get single review of a vendor
List of a single vendors reviews created on your site by calling the MultiVendorX vendors API and using the GET method.
HTTP request
/wp-json/wc/v2/orders/[order_id]?vendor=[vendor_id]
curl -X POST https://example.com/wp-json/wc/v2/orders/485/?vendor=13 \
-u consumer_key:consumer_secret
Response:
Response data received is same as above except for the fact, only the specific order is retrieved.
Create a new vendor review:
A new vendor review can be created by calling this MultivenorX API and by using the POST method :
Accepted Parameters
Attribute | Description |
---|---|
vendor_id |
Unique identifier for the vendor |
reviews_list |
The list of vendor review |
rating_count |
The total rating of a vendor |
review_id |
Unique identifier for a review |
HTTP request
/wp-json/wc/v2/orders/?vendor=[vendor_id]
curl -X GET https://example.com/wp-json/wc/v2/orders?vendor=13 \
-u consumer_key:consumer_secret
Response:
[
{
"id": 480,
"parent_id": 0,
"number": "480",
"order_key": "wc_order_5b32210b5888a",
"created_via": "checkout",
"version": "3.4.2",
"status": "processing",
"currency": "USD",
"date_created": "2018-06-26T11:18:35",
"date_created_gmt": "2018-06-26T11:18:35",
"date_modified": "2018-06-26T11:18:39",
"date_modified_gmt": "2018-06-26T11:18:39",
"discount_total": "0.00",
"discount_tax": "0.00",
"shipping_total": "0.00",
"shipping_tax": "0.00",
"cart_tax": "9.09",
"total": "100.00",
"total_tax": "9.09",
"prices_include_tax": true,
"customer_id": 18,
"customer_ip_address": "::1",
"customer_user_agent": "mozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml, like gecko) ubuntu chromium/62.0.3202.75 chrome/62.0.3202.75 safari/537.36",
"customer_note": "",
"billing": {
"first_name": "Customer",
"last_name": "Test",
"company": "",
"address_1": "1, Happy Street",
"address_2": "",
"city": "New York City",
"state": "CA",
"postcode": "10001",
"country": "US",
"email": "test@hm.com",
"phone": "9876543210"
},
"shipping": {
"first_name": "Customer",
"last_name": "Test",
"company": "",
"address_1": "1, Happy Street",
"address_2": "",
"city": "New York City",
"state": "CA",
"postcode": "10001",
"country": "US"
},
"payment_method": "cod",
"payment_method_title": "Cash on delivery",
"transaction_id": "",
"date_paid": null,
"date_paid_gmt": null,
"date_completed": null,
"date_completed_gmt": null,
"cart_hash": "d16e86a2720e474fde669e38611608a3",
"meta_data": [
{
"id": 11251,
"key": "_wcmp_order_processed",
"value": "1"
},
{
"id": 11261,
"key": "_commission_ids",
"value": [
481
]
},
{
"id": 11262,
"key": "_commissions_processed",
"value": "yes"
}
],
"line_items": [
{
"id": 101,
"name": "Pro 1",
"product_id": 418,
"variation_id": 0,
"quantity": 1,
"tax_class": "",
"subtotal": "90.91",
"subtotal_tax": "9.09",
"total": "90.91",
"total_tax": "9.09",
"taxes": [
{
"id": 1,
"total": "9.090909",
"subtotal": "9.090909"
}
],
"meta_data": [
{
"id": 857,
"key": "Sold By",
"value": "debleena5"
},
{
"id": 858,
"key": "_vendor_id",
"value": "13"
}
],
"sku": "pro-001",
"price": 90.909091
}
],
"tax_lines": [
{
"id": 103,
"rate_code": "TAX-1",
"rate_id": 1,
"label": "Tax",
"compound": false,
"tax_total": "9.09",
"shipping_tax_total": "0.00",
"meta_data": []
}
],
"shipping_lines": [
{
"id": 102,
"method_title": "Flat rate",
"method_id": "flat_rate",
"instance_id": "3",
"total": "0.00",
"total_tax": "0.00",
"taxes": [],
"meta_data": [
{
"id": 864,
"key": "Items",
"value": "Pro 1 × 1"
},
{
"id": 865,
"key": "vendor_id",
"value": "13"
},
{
"id": 866,
"key": "package_qty",
"value": "1"
}
]
}
],
"fee_lines": [],
"coupon_lines": [],
"refunds": [],
"_links": {
"self": [
{
"href": "http://example.com/wp-json/wc/v2/orders/480"
}
],
"collection": [
{
"href": "http://example.com/wp-json/wc/v2/orders"
}
],
"customer": [
{
"href": "http://example.com/wp-json/wc/v2/customers/18"
}
]
}
},
{
"id": 464,
"parent_id": 0,
"number": "464",
"order_key": "wc_order_5b2232bfaf898",
"created_via": "checkout",
"version": "3.4.2",
"status": "on-hold",
"currency": "USD",
"date_created": "2018-06-14T09:17:51",
"date_created_gmt": "2018-06-14T09:17:51",
"date_modified": "2018-06-14T09:17:55",
"date_modified_gmt": "2018-06-14T09:17:55",
"discount_total": "0.00",
"discount_tax": "0.00",
"shipping_total": "0.00",
"shipping_tax": "0.00",
"cart_tax": "9.09",
"total": "100.00",
"total_tax": "9.09",
"prices_include_tax": true,
"customer_id": 5,
"customer_ip_address": "127.0.0.1",
"customer_user_agent": "mozilla/5.0 (x11; ubuntu; linux x86_64; rv:56.0) gecko/20100101 firefox/56.0",
"customer_note": "",
"billing": {
"first_name": "Jimmy",
"last_name": "Parker",
"company": "ABC Text",
"address_1": "Thatcham Business Village, Colthrop Way",
"address_2": "",
"city": "Thatcham",
"state": "England",
"postcode": "RG19 4LW",
"country": "GB",
"email": "customer@fm.cm",
"phone": "987654670"
},
"shipping": {
"first_name": "Jimmy",
"last_name": "Parker",
"company": "ABC Text",
"address_1": "Thatcham Business Village, Colthrop Way",
"address_2": "",
"city": "Thatcham",
"state": "England",
"postcode": "RG19 4LW",
"country": "GB"
},
"payment_method": "bacs",
"payment_method_title": "Direct bank transfer",
"transaction_id": "",
"date_paid": null,
"date_paid_gmt": null,
"date_completed": null,
"date_completed_gmt": null,
"cart_hash": "d16e86a2720e474fde669e38611608a3",
"meta_data": [
{
"id": 10938,
"key": "_wcmp_order_processed",
"value": "1"
}
],
"line_items": [
{
"id": 80,
"name": "Pro 1",
"product_id": 418,
"variation_id": 0,
"quantity": 1,
"tax_class": "",
"subtotal": "90.91",
"subtotal_tax": "9.09",
"total": "90.91",
"total_tax": "9.09",
"taxes": [
{
"id": 1,
"total": "9.090909",
"subtotal": "9.090909"
}
],
"meta_data": [
{
"id": 699,
"key": "Sold By",
"value": "debleena5"
},
{
"id": 700,
"key": "_vendor_id",
"value": "13"
}
],
"sku": "pro-001",
"price": 90.909091
}
],
"tax_lines": [
{
"id": 82,
"rate_code": "TAX-1",
"rate_id": 1,
"label": "Tax",
"compound": false,
"tax_total": "9.09",
"shipping_tax_total": "0.00",
"meta_data": []
}
],
"shipping_lines": [
{
"id": 81,
"method_title": "Free shipping",
"method_id": "free_shipping",
"instance_id": "1",
"total": "0.00",
"total_tax": "0.00",
"taxes": [],
"meta_data": [
{
"id": 706,
"key": "Items",
"value": "Pro 1 × 1"
},
{
"id": 707,
"key": "vendor_id",
"value": "13"
},
{
"id": 708,
"key": "package_qty",
"value": "1"
}
]
}
],
"fee_lines": [],
"coupon_lines": [],
"refunds": [],
"_links": {
"self": [
{
"href": "http://example.com/wp-json/wc/v2/orders/464"
}
],
"collection": [
{
"href": "http://example.com/wp-json/wc/v2/orders"
}
],
"customer": [
{
"href": "http://example.com/wp-json/wc/v2/customers/5"
}
]
}
}
]
Update a single vendor review:
A single vendor review can be created by calling this MultivenorX API and by using the POST method :
Accepted Parameters
Attribute | Description |
---|---|
vendor_id |
Unique identifier for the vendor |
reviews_list |
The list of vendor review |
rating_count |
The total rating of a vendor |
review_id |
Unique identifier for a review |
HTTP request
/wp-json/wc/v2/orders/?vendor=[vendor_id]
curl -X GET https://example.com/wp-json/wc/v2/orders?vendor=13 \
-u consumer_key:consumer_secret
Response:
[
{
"id": 480,
"parent_id": 0,
"number": "480",
"order_key": "wc_order_5b32210b5888a",
"created_via": "checkout",
"version": "3.4.2",
"status": "processing",
"currency": "USD",
"date_created": "2018-06-26T11:18:35",
"date_created_gmt": "2018-06-26T11:18:35",
"date_modified": "2018-06-26T11:18:39",
"date_modified_gmt": "2018-06-26T11:18:39",
"discount_total": "0.00",
"discount_tax": "0.00",
"shipping_total": "0.00",
"shipping_tax": "0.00",
"cart_tax": "9.09",
"total": "100.00",
"total_tax": "9.09",
"prices_include_tax": true,
"customer_id": 18,
"customer_ip_address": "::1",
"customer_user_agent": "mozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml, like gecko) ubuntu chromium/62.0.3202.75 chrome/62.0.3202.75 safari/537.36",
"customer_note": "",
"billing": {
"first_name": "Customer",
"last_name": "Test",
"company": "",
"address_1": "1, Happy Street",
"address_2": "",
"city": "New York City",
"state": "CA",
"postcode": "10001",
"country": "US",
"email": "test@hm.com",
"phone": "9876543210"
},
"shipping": {
"first_name": "Customer",
"last_name": "Test",
"company": "",
"address_1": "1, Happy Street",
"address_2": "",
"city": "New York City",
"state": "CA",
"postcode": "10001",
"country": "US"
},
"payment_method": "cod",
"payment_method_title": "Cash on delivery",
"transaction_id": "",
"date_paid": null,
"date_paid_gmt": null,
"date_completed": null,
"date_completed_gmt": null,
"cart_hash": "d16e86a2720e474fde669e38611608a3",
"meta_data": [
{
"id": 11251,
"key": "_wcmp_order_processed",
"value": "1"
},
{
"id": 11261,
"key": "_commission_ids",
"value": [
481
]
},
{
"id": 11262,
"key": "_commissions_processed",
"value": "yes"
}
],
"line_items": [
{
"id": 101,
"name": "Pro 1",
"product_id": 418,
"variation_id": 0,
"quantity": 1,
"tax_class": "",
"subtotal": "90.91",
"subtotal_tax": "9.09",
"total": "90.91",
"total_tax": "9.09",
"taxes": [
{
"id": 1,
"total": "9.090909",
"subtotal": "9.090909"
}
],
"meta_data": [
{
"id": 857,
"key": "Sold By",
"value": "debleena5"
},
{
"id": 858,
"key": "_vendor_id",
"value": "13"
}
],
"sku": "pro-001",
"price": 90.909091
}
],
"tax_lines": [
{
"id": 103,
"rate_code": "TAX-1",
"rate_id": 1,
"label": "Tax",
"compound": false,
"tax_total": "9.09",
"shipping_tax_total": "0.00",
"meta_data": []
}
],
"shipping_lines": [
{
"id": 102,
"method_title": "Flat rate",
"method_id": "flat_rate",
"instance_id": "3",
"total": "0.00",
"total_tax": "0.00",
"taxes": [],
"meta_data": [
{
"id": 864,
"key": "Items",
"value": "Pro 1 × 1"
},
{
"id": 865,
"key": "vendor_id",
"value": "13"
},
{
"id": 866,
"key": "package_qty",
"value": "1"
}
]
}
],
"fee_lines": [],
"coupon_lines": [],
"refunds": [],
"_links": {
"self": [
{
"href": "http://example.com/wp-json/wc/v2/orders/480"
}
],
"collection": [
{
"href": "http://example.com/wp-json/wc/v2/orders"
}
],
"customer": [
{
"href": "http://example.com/wp-json/wc/v2/customers/18"
}
]
}
},
{
"id": 464,
"parent_id": 0,
"number": "464",
"order_key": "wc_order_5b2232bfaf898",
"created_via": "checkout",
"version": "3.4.2",
"status": "on-hold",
"currency": "USD",
"date_created": "2018-06-14T09:17:51",
"date_created_gmt": "2018-06-14T09:17:51",
"date_modified": "2018-06-14T09:17:55",
"date_modified_gmt": "2018-06-14T09:17:55",
"discount_total": "0.00",
"discount_tax": "0.00",
"shipping_total": "0.00",
"shipping_tax": "0.00",
"cart_tax": "9.09",
"total": "100.00",
"total_tax": "9.09",
"prices_include_tax": true,
"customer_id": 5,
"customer_ip_address": "127.0.0.1",
"customer_user_agent": "mozilla/5.0 (x11; ubuntu; linux x86_64; rv:56.0) gecko/20100101 firefox/56.0",
"customer_note": "",
"billing": {
"first_name": "Jimmy",
"last_name": "Parker",
"company": "ABC Text",
"address_1": "Thatcham Business Village, Colthrop Way",
"address_2": "",
"city": "Thatcham",
"state": "England",
"postcode": "RG19 4LW",
"country": "GB",
"email": "customer@fm.cm",
"phone": "987654670"
},
"shipping": {
"first_name": "Jimmy",
"last_name": "Parker",
"company": "ABC Text",
"address_1": "Thatcham Business Village, Colthrop Way",
"address_2": "",
"city": "Thatcham",
"state": "England",
"postcode": "RG19 4LW",
"country": "GB"
},
"payment_method": "bacs",
"payment_method_title": "Direct bank transfer",
"transaction_id": "",
"date_paid": null,
"date_paid_gmt": null,
"date_completed": null,
"date_completed_gmt": null,
"cart_hash": "d16e86a2720e474fde669e38611608a3",
"meta_data": [
{
"id": 10938,
"key": "_wcmp_order_processed",
"value": "1"
}
],
"line_items": [
{
"id": 80,
"name": "Pro 1",
"product_id": 418,
"variation_id": 0,
"quantity": 1,
"tax_class": "",
"subtotal": "90.91",
"subtotal_tax": "9.09",
"total": "90.91",
"total_tax": "9.09",
"taxes": [
{
"id": 1,
"total": "9.090909",
"subtotal": "9.090909"
}
],
"meta_data": [
{
"id": 699,
"key": "Sold By",
"value": "debleena5"
},
{
"id": 700,
"key": "_vendor_id",
"value": "13"
}
],
"sku": "pro-001",
"price": 90.909091
}
],
"tax_lines": [
{
"id": 82,
"rate_code": "TAX-1",
"rate_id": 1,
"label": "Tax",
"compound": false,
"tax_total": "9.09",
"shipping_tax_total": "0.00",
"meta_data": []
}
],
"shipping_lines": [
{
"id": 81,
"method_title": "Free shipping",
"method_id": "free_shipping",
"instance_id": "1",
"total": "0.00",
"total_tax": "0.00",
"taxes": [],
"meta_data": [
{
"id": 706,
"key": "Items",
"value": "Pro 1 × 1"
},
{
"id": 707,
"key": "vendor_id",
"value": "13"
},
{
"id": 708,
"key": "package_qty",
"value": "1"
}
]
}
],
"fee_lines": [],
"coupon_lines": [],
"refunds": [],
"_links": {
"self": [
{
"href": "http://example.com/wp-json/wc/v2/orders/464"
}
],
"collection": [
{
"href": "http://example.com/wp-json/wc/v2/orders"
}
],
"customer": [
{
"href": "http://example.com/wp-json/wc/v2/customers/5"
}
]
}
}
]
Changelog
1.0.0 – 2018-06-12
- Initial commit
- Uses OAuth 1.0
- Includes basic vendor, products by vendor, orders by vendor and coupons by vendor REST API
Errors
The MultiVendorX API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request -- Your request is invalid. |
401 | Unauthorized -- Your API key is wrong. |
403 | Forbidden -- The kitten requested is hidden for administrators only. |
404 | Not Found -- The specified kitten could not be found. |
405 | Method Not Allowed -- You tried to access a kitten with an invalid method. |
406 | Not Acceptable -- You requested a format that isn't json. |
410 | Gone -- The kitten requested has been removed from our servers. |
418 | I'm a teapot. |
429 | Too Many Requests -- You're requesting too many kittens! Slow down! |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |