User Tools

Site Tools


udropship:umarketplace:vendor-api

This is an old revision of the document!


uMarketplace Vendor API Add-on

Introduction

This add-on extend magento Soap API and allow vendors utilize it to pull/update Purchase Orders information and update inventory data. To get more technical details check:

  1. app\code\community\Unirgy\DropshipApi\etc\wsdl.xml/ - API wsdl definition - app\code\community\Unirgy\DropshipApi\etc\acl.xml/ - API acl definition

Authentication

In order to perform API operations vendor need authentication. System use authentication by vendor email/apiKey. Before doing actual API calls vendor need to get authentication token by doing login soap call with username, api key parameters. Response of that POST will be 32 bit token that need to be used for further API calls in sessionId request parameter to prove vendor identity. More information you can get here http://devdocs.magento.com/guides/m1x/api/soap/introduction.html

Example:
POST /index.php/api/v2_soap/index/ HTTP/1.1
<?xml version=“1.0” encoding=“UTF-8”?> <SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/” xmlns:ns1=“urn:Magento” xmlns:xsd=“http://www.w3.org/2001/XMLSchema” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xmlns:SOAP-ENC=“http://schemas.xmlsoap.org/soap/encoding/” SOAP-ENV:encodingStyle=“http://schemas.xmlsoap.org/soap/encoding/”><SOAP-ENV:Body><ns1:login><username xsi:type=“xsd:string”>xxx</username><apiKey xsi:type=“xsd:string”>xxxx</apiKey></ns1:login></SOAP-ENV:Body></SOAP-ENV:Envelope>

RESPONSE
<?xml version=“1.0” encoding=“UTF-8”?> <SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/” xmlns:ns1=“urn:Magento” xmlns:xsd=“http://www.w3.org/2001/XMLSchema” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xmlns:SOAP-ENC=“http://schemas.xmlsoap.org/soap/encoding/” SOAP-ENV:encodingStyle=“http://schemas.xmlsoap.org/soap/encoding/”> <SOAP-ENV:Body> <ns1:loginResponse> <loginReturn xsi:type=“xsd:string”>2dc6db6698fd2bac2f8e478238cafe74</loginReturn> </ns1:loginResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

Get list of Vendor Purchase Orders (possible to filter)

In order to get list of Purchase Orders need to perform salesOrderUdpoList API call. It expect filter or complex_filter as parameter. More details on how to construct such filter check http://devdocs.magento.com/guides/m1x/api/soap/sales/salesOrderShipment/sales_order_shipment.list.html

Example:
<?xml version=“1.0” encoding=“UTF-8”?> <SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/” xmlns:ns1=“urn:Magento” xmlns:xsd=“http://www.w3.org/2001/XMLSchema” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xmlns:SOAP-ENC=“http://schemas.xmlsoap.org/soap/encoding/” SOAP-ENV:encodingStyle=“http://schemas.xmlsoap.org/soap/encoding/”><SOAP-ENV:Body><ns1:salesOrderUdpoList><sessionId xsi:type=“xsd:string”>2dc6db6698fd2bac2f8e478238cafe74</sessionId><filters xsi:type=“ns1:filters”><complex_filter SOAP-ENC:arrayType=“ns1:complexFilter[1]” xsi:type=“ns1:complexFilterArray”><item xsi:type=“ns1:complexFilter”><key xsi:type=“xsd:string”>created_at</key><value xsi:type=“ns1:associativeEntity”><key xsi:type=“xsd:string”>gt</key><value xsi:type=“xsd:string”>2018-02-01</value></value></item></complex_filter></filters></ns1:salesOrderUdpoList></SOAP-ENV:Body></SOAP-ENV:Envelope>

RESPONSE <?xml version=“1.0” encoding=“UTF-8”?> <SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/” xmlns:ns1=“urn:Magento” xmlns:SOAP-ENC=“http://schemas.xmlsoap.org/soap/encoding/” xmlns:xsd=“http://www.w3.org/2001/XMLSchema” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” SOAP-ENV:encodingStyle=“http://schemas.xmlsoap.org/soap/encoding/”> <SOAP-ENV:Body> <ns1:salesOrderUdpoListResponse> <result SOAP-ENC:arrayType=“ns1:salesOrderUdpoEntity[3]” xsi:type=“ns1:salesOrderUdpoEntityArray”> <item xsi:type=“ns1:salesOrderUdpoEntity”> <increment_id xsi:type=“xsd:string”>145000016-1</increment_id> <created_at xsi:type=“xsd:string”>2018-02-01 17:24:50</created_at> <total_qty xsi:type=“xsd:string”>3.0000</total_qty> </item> <item xsi:type=“ns1:salesOrderUdpoEntity”> <increment_id xsi:type=“xsd:string”>145000017-1</increment_id> <created_at xsi:type=“xsd:string”>2018-02-01 17:28:24</created_at> <total_qty xsi:type=“xsd:string”>3.0000</total_qty> </item> <item xsi:type=“ns1:salesOrderUdpoEntity”> <increment_id xsi:type=“xsd:string”>145000018-1</increment_id> <created_at xsi:type=“xsd:string”>2018-02-01 17:29:44</created_at> <total_qty xsi:type=“xsd:string”>3.0000</total_qty> </item> </result> </ns1:salesOrderUdpoListResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

Get Single Purchase Order Info

In order to get list of single Purchase Order information need to perform /V1/udpo/:id GET API call. :id parameter could be either Purchase Order entity id or it's increment id.

Example:
<?xml version=“1.0” encoding=“UTF-8”?> <SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/” xmlns:ns1=“urn:Magento” xmlns:xsd=“http://www.w3.org/2001/XMLSchema” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xmlns:SOAP-ENC=“http://schemas.xmlsoap.org/soap/encoding/” SOAP-ENV:encodingStyle=“http://schemas.xmlsoap.org/soap/encoding/”><SOAP-ENV:Body><ns1:salesOrderUdpoInfo><sessionId xsi:type=“xsd:string”>2dc6db6698fd2bac2f8e478238cafe74</sessionId><udpoIncrementId xsi:type=“xsd:string”>145000018-1</udpoIncrementId></ns1:salesOrderUdpoInfo></SOAP-ENV:Body></SOAP-ENV:Envelope>\
RESPONSE
<?xml version=“1.0” encoding=“UTF-8”?> <SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/” xmlns:ns1=“urn:Magento” xmlns:xsd=“http://www.w3.org/2001/XMLSchema” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xmlns:SOAP-ENC=“http://schemas.xmlsoap.org/soap/encoding/” SOAP-ENV:encodingStyle=“http://schemas.xmlsoap.org/soap/encoding/”> <SOAP-ENV:Body> <ns1:salesOrderUdpoInfoResponse> <result xsi:type=“ns1:salesOrderUdpoEntity”> <increment_id xsi:type=“xsd:string”>145000018-1</increment_id> <store_id xsi:type=“xsd:string”>1</store_id> <created_at xsi:type=“xsd:string”>2018-02-01 17:29:44</created_at> <updated_at xsi:type=“xsd:string”>2018-02-01 17:29:44</updated_at> <order_id xsi:type=“xsd:string”>207</order_id> <total_qty xsi:type=“xsd:string”>3.0000</total_qty> <po_id xsi:type=“xsd:string”>9</po_id> <items SOAP-ENC:arrayType=“ns1:salesOrderUdpoItemEntity[1]” xsi:type=“ns1:salesOrderUdpoItemEntityArray”> <item xsi:type=“ns1:salesOrderUdpoItemEntity”> <parent_id xsi:type=“xsd:string”>9</parent_id> <sku xsi:type=“xsd:string”>ugiftcert</sku> <name xsi:type=“xsd:string”>ugiftcert</name> <order_item_id xsi:type=“xsd:string”>626</order_item_id> <product_id xsi:type=“xsd:string”>1106</product_id> <weight xsi:type=“xsd:string”>1.0000</weight> <price xsi:type=“xsd:string”>10.0000</price> <qty xsi:type=“xsd:string”>3.0000</qty> <item_id xsi:type=“xsd:string”>23</item_id> </item> </items> <tracks SOAP-ENC:arrayType=“ns1:salesOrderUdpoTrackEntity[0]” xsi:type=“ns1:salesOrderUdpoTrackEntityArray”/> <comments SOAP-ENC:arrayType=“ns1:salesOrderUdpoCommentEntity[0]” xsi:type=“ns1:salesOrderUdpoCommentEntityArray”/> </result> </ns1:salesOrderUdpoInfoResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

Get Purchase Order Comments List

In order to get list of Purchase Order comments need to perform /V1/udpo/:id/comments GET API call. :id parameter could be either Purchase Order entity id or it's increment id.

Example:
GET http://magento222.loc/index.php/rest/V1/udpo/000000012-1/comments

RESPONSE
{“items”:[{“is_customer_notified”:null,“parent_id”:1,“comment”:“[vendor1 changed PO status from 'Pending' to 'Ready to Ship']”,“is_visible_on_front”:null,“created_at”:“2018-03-02 18:34:08”,“entity_id”:1},{“is_customer_notified”:null,“parent_id”:1,“comment”:“vendor1: Test API Comment”,“is_visible_on_front”:null,“created_at”:“2018-03-12 09:05:16”,“entity_id”:2},{“is_customer_notified”:null,“parent_id”:1,“comment”:“[vendor1 changed PO status from 'Ready to Ship' to 'Acknowledged']”,“is_visible_on_front”:null,“created_at”:“2018-03-12 09:05:41”,“entity_id”:3},{“is_customer_notified”:null,“parent_id”:1,“comment”:“vendor1: Test API Comment with status change”,“is_visible_on_front”:null,“created_at”:“2018-03-12 09:05:41”,“entity_id”:4}],“search_criteria”:{“filter_groups”:[{“filters”:[{“field”:“parent_id”,“value”:“1”,“condition_type”:“eq”}]}]},“total_count”:4}

Add comment to Purchase Order

In order to add comment to Purchase Order perform /V1/udpo/:id/addComment POST API call. :id parameter could be either Purchase Order entity id or it's increment id. Request payload expect comment string parameter and optional status parameter. For possible values check app\code\Unirgy\DropshipPo\Model\Source.php UDPO_STATUS_* string constants. It return bool true on success and may rise exception if PO not found or does not belong to vendor.

Example:
POST http://magento222.loc/index.php/rest/V1/udpo/000000012-1/addComment
{“comment”:“Test API Comment”,“status”:9}

RESPONSE true

Add tracking number to Purchase Order

In order to add tracking number to Purchase Order perform /V1/udpo/:id/addTrack POST API call. :id parameter could be either Purchase Order entity id or it's increment id. Request payload expect carrier code in carrier string parameter, carrier title in title parameter and tracking number in trackNumber parameter. It return bool true on success and may rise exception if PO not found or does not belong to vendor.

Example:
POST http://magento222.loc/index.php/rest/V1/udpo/000000012-1/addTrack
{“carrier”:“ups”,“title”:“UPS”,“trackNumber”:“UPS12345”}

RESPONSE true

Delete tracking number from Purchase Order

In order to delete tracking number from Purchase Order perform /V1/udpo/:id/deleteTrack/:trackNumber POST API call. :id parameter could be either Purchase Order entity id or it's increment id, :trackNumber should be tracking number. It return bool true on success and may rise exception if PO not found or does not belong to vendor and if tracking number not found within PO.

Example:
POST http://magento222.loc/index.php/rest/V1/udpo/000000012-1/deleteTrack/UPS12345
[]

RESPONSE true

Perform Inventory update

Vendor can use /V1/udstock/update POST API calls to update his products inventory (products offers when multivendor add-on used). Request payload expect items parameter which should be array of arrays (later one contain single offer data details). Each offer detail can have following parameters:

  • sku
  • priority
  • carrier_code
  • vendor_sku
  • vendor_cost
  • stock_qty
  • stock_qty_add
  • backorders
  • status
  • shipping_price
  • vendor_title
  • state
  • state_descr
  • freeshipping
  • vendor_price
  • special_price
  • specialFromDate
  • specialToDate

But only sku or vendor_sku are required. When not using multivendor add-on it's possible to use only this keys in offer details array sku, vendor_sku, stock_qty, stock_qty_add

Response of API call will contain string information of how many items were updated and errors list at the end if any.

Example:
POST http://magento222.loc/index.php/rest/V1/udstock/update/
{“items”:[{“sku”:“24-MB01”,“vendor_sku”:“v2-24-MB01”,“stock_qty”:“11”},{“vendor_sku”:“v2-24-MB04”,“stock_qty”:“22”},{“vendor_sku”:“not-existing-vendor-sku”,“stock_qty”:“22”},{“sku”:“not-existing-sku”,“vendor_sku”:“not-existing-vendor-sku”,“stock_qty”:“22”}]}

RESPONSE
“Updated 2 items of 4: (Product not found for vendor sku \”not-existing-vendor-sku\“, Product not found for sku \”not-existing-sku\“)”

udropship/umarketplace/vendor-api.1521453885.txt.gz · by wtsergo