====== uMarketplace Vendor API Add-on======
===== Introduction =====
The Vendor API add-on extends Magento Soap API and allow vendors to utilize it to pull/update Purchase Orders information and update inventory data.
To get more technical details check:\\
- //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. The system authenticates the vendor by their email/apiKey. Before performing an actual API calls, vendor need to get authentication token by **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. When in SessionId, request parameter to prove vendor identity. More information is avaialble here [[http://devdocs.magento.com/guides/m1x/api/soap/introduction.html]]
''
Example:\\
POST /index.php/api/v2_soap/index/ HTTP/1.1\\
xxxxxxx\\
\\
RESPONSE\\
2dc6db6698fd2bac2f8e478238cafe74
''
===== Get list of Vendor Purchase Orders (possible to filter) =====
In order to get list of Purchase Orders, salesOrderUdpoList API call will have to be performed. 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:\\
2dc6db6698fd2bac2f8e478238cafe74- created_atgt2018-02-01
\\
\\
RESPONSE\\
-
145000016-1
2018-02-01 17:24:50
3.0000
-
145000017-1
2018-02-01 17:28:24
3.0000
-
145000018-1
2018-02-01 17:29:44
3.0000
''
===== Get Single Purchase Order Info =====
In order to get single Purchase Order information, **salesOrderUdpoInfo** API call will have to be performed. Parameter could be either Purchase Order entity id or it's increment id.
''
Example:\\
2dc6db6698fd2bac2f8e478238cafe74145000018-1\
\\
RESPONSE\\
145000018-1
1
2018-02-01 17:29:44
2018-02-01 17:29:44
207
3.0000
9
-
9
ugiftcert
ugiftcert
626
1106
1.0000
10.0000
3.0000
23
''
===== Add comment to Purchase Order =====
In order to add comment to Purchase Order, perform **salesOrderUdpoAddComment** API call. Parameters are ''udpoIncrementId'' - Purchase Order increment id, ''- comment'' string parameter.
''
Example:\\
3e60ad92322db9005c7ea21cd11966d7145000018-1test api comment\\
\\
RESPONSE
true
''
===== Add tracking number to Purchase Order =====
In order to add tracking number to Purchase Order perform **salesOrderUdpoAddTrack** API call. Parameters are ''udpoIncrementId'' - Purchase Order increment id, ''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:\\
a81bf7681b46f0e4bc8322ed12a090a1145000015-1upsupstrack100000202-2-ext1\\
\\
RESPONSE\\
1
''
===== Delete tracking number from Purchase Order =====
In order to delete tracking number from Purchase Order perform **salesOrderUdpoRemoveTrack** API call. Parameters are ''udpoIncrementId'' - Purchase Order increment id 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:\\
1c3f163fc457ed4b975a5081a3e2158e145000015-1track100000202-2-ext1\\
\\
RESPONSE
true
''
===== Perform Inventory update =====
Vendors can use **salesUdstockUpdate** API calls to update ther 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 Multivendor add-on is not used, 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:\\
a3d459b6dff11cd103096df1d96fc8a1- ace000v2-ace00011
- v2-ace00122
- not-existing-vendor-sku22
- not-existing-skunot-existing-vendor-sku22
\\
\\
RESPONSE\\
Updated 1 items of 4: (Product not found for vendor sku "v2-ace001", Product not found for vendor sku "not-existing-vendor-sku", Product not found for sku "not-existing-sku")
''