====== Setting Ysell.pro through API ====== > API (Application Programming Interface) serves as an interface between programs and simplifies their interaction. > Ysell offers the possibility to work with web services through our own API. ---- > To work with the API, you should specify an API token for the user. >> Bearer authentication is an HTTP authentication scheme that uses security markers called bearer tokens. The bearer token is an encoded string that is usually generated by the server in response to a request for input to the system. A client should send the token in the Authorization header while creating the request: Authorization: bearer . ---- > Go to the **Users** tab (**Settings** -> **Users**). > Add a new user (API token should be field with a random value). >>{{:ru:api.png?700|}} {{:ru:api_1.png?500|}} > Go to **Settings - ysell API** >>{{:ru:apwi.png?600|}} ---- > Authorize with the API token by clicking **Authorize**. Enter **Bearer** and //generated API key// in the authentication string. >>{{:ru:api_23.png?600|}} {{:ru:apibearer_2.png?600|}} ---- ====== Product ====== **Curl** curl -X 'GET' \ 'https://719.eu6.ysell.pro/api/v1/product' \ -H 'accept: */*' \ -H 'Authorization: Bearer' **Response body** [ { "id": 1, "ext_id": "1", "title": "Melozio", "condition": "New", "manufacturer_id": 1, "purchase_price": "2.50", "netto": 100, "main_supplier": { "id": 1, "product_id": 1, "supplier_id": 1, "supplier_num": "45245634", "note": "", "url": "", "qty": 0, "price": "2.50", "discount_enabled": 0, "discount_price": null, "discount_qty": 0, "main": 1 }, "listings": [], "image": "" }, //Retrieving the customer's product list// >**Get products list** - Retrieving the customer's product list > **Page** parameter - Specify the page from which the import is done > **Per-page** - Number of products per page >{{:ru:api_2.png?900|}} > > > > > > > > > ---- >**Create New Product** **Curl** curl -X 'POST' \ 'https://719.eu6.ysell.pro/api/v1/product' \ -H 'accept: */*' \ -H 'Authorization: Bearer 123321' \ -H 'Content-Type: multipart/form-data' \ -F 'productDimensionW=10' \ -F 'masterboxWeight=17' \ -F 'packageDimensionD=6' \ -F 'productWeight=0.1' \ -F 'masterboxDimensionD=60' \ -F 'packageDimensionH=12' \ -F 'productWeightUnits=kg' \ -F 'manufacturer_id=1' \ -F 'masterboxDimensionH=60' \ -F 'product_image=https://719.eu6.ysell.pro/product_images/150/1.jpg' \ -F 'masterboxQty=200' \ -F 'productDimensionD=6' \ -F 'masterboxWeightUnits=kg' \ -F 'packageDimensionUnits=cm' \ -F 'productDimensionH=12' \ -F 'packageWeightUnits=kg' \ -F 'masterboxDimensionUnits=cm' \ -F 'packageDimensionW=10' \ -F 'productDimensionUnits=cm' \ -F 'title=Tequila Sunset' \ -F 'ext_id=p-719-155' \ -F 'masterboxDimensionW=120' \ -F 'id=155' \ -F 'packageWeight=0.5' **Response body** { "id": 155, "ext_id": "p-719-155", "title": "Tequila Sunset", "condition": "New", "manufacturer_id": 1, "purchase_price": null, "netto": 0, "main_supplier": null, "listings": [], "image": "https://719.eu6.ysell.pro/product_images/150/1.jpg" } //Creation of a product with ID 155 named Tequila Sunset, specifying the product dimensions, packaging size and product image.// >**id** - Product ID >**ext_id** - **Product ID** of the product. >**title** - Product title. >**product_image** - Link to the product image. >**manufacturer_id** - ID from previously created product manufacturers. >**packageDimensionW** - Package dimensions of the product (Width). >**packageDimensionH** - Package dimensions of the product (Height). >**packageDimensionD** - Package dimensions of the product (Depth). >**packageDimensionUnits** - Unit measure of the package. >**packageWeight** - Weight of the package. >**packageWeightUnits** - Unit measure of the product weight. >**masterboxDimensionW** - Masterbox dimension (Width). >**masterboxDimensionH** - Masterbox dimension (Height). >**masterboxDimensionD** - Masterbox dimension (Depth). >**masterboxDimensionUnits** - Unit measurement dimension of the masterbox. >**masterboxQty** - Masterbox quantity of the product. >**masterboxWeight** - Masterbox weight with the product. >**masterboxWeightUnits** - Unit of measurement for the weight of the master box with the product. >**productDimensionD** - Product dimension (Depth). >**productDimensionW** - Product dimension (Width). >**productDimensionH** - Product dimension (Height). >**productDimensionUnits** - Unit of measurement of the product unit. >**productWeightUnits** - Unit of measurement for the weight of the product. >**productWeight** - Weight of the product. >>{{:ru:api_3.png?780|}} ---- **Curl** curl -X 'GET' \ 'https://719.eu6.ysell.pro/api/v1/product/155' \ -H 'accept: application/json' \ -H 'Authorization: Bearer 123321' **Response body** { "id": 155, "ext_id": "p-719-155", "title": "Tequila Sunset", "condition": "New", "manufacturer_id": 1, "purchase_price": null, "netto": 0, "main_supplier": null, "listings": [], "image": "https://719.eu6.ysell.pro/product_images/150/1.jpg" } //Retrieve information about a product by its ID// >**Find Product by ID** - is used to obtain information about a product based on its ID. > >**productId** - indicate the product ID >{{:ru:api_4.png?850|}} > > > > > > > > > ---- >**Update product** - is used for editing the previously created ID of the product. Specify the information to be edited in the **Request body** block. > >**productId** - enter a product ID. >{{:ru:api_5.png?900|}} ---- **Curl** curl -X 'DELETE' \ 'https://719.eu6.ysell.pro/api/v1/product/153' \ -H 'accept: */*' \ -H 'Authorization: Bearer 123321' //Deleting product ID// >**Delete Product** - is used to delete the product ID. >>{{:ru:api_6.png?600|}} ---- >**Create fbm/fba lisging** - is used for the creation of Amazon listings. >**productId** - Enter product ID to add FBM/FBA listing. >**company_id** - Company ID specified as the owner of the list. >**marketplace_id** - Marketplace ID [[https://docs.developer.amazonservices.com/en_US/dev_guide/DG_Endpoints.html|list of marketplaces IDs]]. >**platform** - Marketplace used for the creation of offers. >**sku** - The specified SKU will be used to create the list. >**asin** - The specified ASIN will be used to create the list. >**type** - Specify the listing type - FBA/FBM. >**title** - Enter ID title. >**price** - Specify list price. >>{{:ru:api_7.png?800|}} ---- **Curl** curl -X 'POST' \ 'https://719.eu6.ysell.pro/api/v1/product/set-supplier' \ -H 'accept: */*' \ -H 'Authorization: Bearer 123321' \ -H 'Content-Type: multipart/form-data' \ -F 'discount_enabled=1' \ -F 'price=11' \ -F 'discount_price=' \ -F 'product_id=155' \ -F 'supplier_id=3' \ -F 'url=google.com' \ -F 'note=Note' \ -F 'supplier_num=322' \ -F 'qty=14' \ -F 'discount_qty=' \ -F 'main=1' **Response body** { "id": 45, "product_id": 155, "supplier_id": 3, "supplier_num": "322", "note": "Note", "url": "google.com", "qty": "14", "price": "11", "discount_enabled": "1", "discount_price": null, "discount_qty": null, "main": "1" } //Product supplier update// >**Update product Suplier** - Is used for updating the information about the product supplier. > >**product_id** - Indicate a product ID. >**supplier_id** - Indicate dicate a supplier ID. >**supplier_num** - Supplier product number. >**price** - Product price. >**discount_price** - Price with discount. >**discount_enabled** - Is used to activate the product discount. 1 - activate, 2 - deactivate. >**qty** - product quantity. >**main** - if the product supplier is the main supplier. >**url** - Link to the website of the supplier. >**note** = note/memo >>{{:ru:api_8.png?700|}} ====== Supplier ====== **Curl** curl -X 'GET' \ 'https://719.eu6.ysell.pro/api/v1/supplier' \ -H 'accept: */*' \ -H 'Authorization: Bearer ' **Response body** [ { "id": 1, "name": "Nespresso DE", "memo": "" }, { "id": 2, "name": "SET", "memo": "" }, { "id": 3, "name": "A&V furniture company ", "memo": null }, { "id": 4, "name": "Test", "memo": "" }, { "id": 5, "name": "2", "memo": "" }, ] //Receive supplier list from a customer // >//Operations with suppliers// > > /supplier Return all supplier - returns the supplier list of a customer. > >{{:ru:api_12.png?750|}} > > > > > > > > > > > > > > ---- **Curl** curl -X 'POST' \ 'https://719.eu6.ysell.pro/api/v1/supplier' \ -H 'accept: */*' \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ -d '{ "id": 0, "name": "testSupplier2" }' **Response body** { "id": 16, "name": "testSupplier2", "memo": null } //Create a supplier with the title testSupplier2// ---- > POST /Supplier to create a new supplier > > Specify supplier name. Supplier ID will be assigned automatically >{{:ru:api_13.png?800|}} ---- **Curl** curl -X 'GET' \ 'https://719.eu6.ysell.pro/api/v1/supplier/322/product' \ -H 'accept: */*' \ -H 'Authorization: Bearer ' **Response body** { "id": 45, "product_id": 155, "supplier_id": 3, "supplier_num": "322", "note": "Note", "url": "google.com", "qty": 14, "price": "11.00", "discount_enabled": 1, "discount_price": null, "discount_qty": 0, "main": 1 } //Retrieve information about the product ID with the number "322// > > > > >GET /supplier/{supplierNum}/product Find product by supplier num - is used for returning ID information by supplier number. > >{{:ru:api_14.png?750|}} > > > > > ---- **Curl** curl -X 'PUT' \ 'https://719.eu6.ysell.pro/api/v1/supplier/3' \ -H 'accept: */*' \ -H 'Authorization: Bearer 123321' \ -H 'Content-Type: application/json' \ -d '{ "id": 0, "name": "UpdatedSupplier" }' **Response body** { "id": 3, "name": "UpdatedSupplier", "memo": null } //Updating information on the Supplier with ID "3"// > GET /supplier/{supplierID} Update Supplier - for information editing on Supplier. > >**supplierId** - specify supplier ID >{{:ru:api_15.png?780|}} ---- **Curl** curl -X 'DELETE' \ 'https://719.eu6.ysell.pro/api/v1/supplier/3' \ -H 'accept: */*' \ -H 'Authorization: Bearer 123321' }' //Deletion of the supplier with ID "3// > >Delete /supplier/{supplierID} - is used to delete information about suppliers. >**supplierId** - Supplier ID >{{:ru:api_16.png?600|}} ====== Manufacturer ====== **Curl** curl -X 'GET' \ 'https://719.eu6.ysell.pro/api/v1/manufacturer' \ -H 'accept: */*' \ -H 'Authorization: Bearer' **Response body** [ { "id": 1, "name": "Nespresso" }, { "id": 3, "name": "A&V furniture company " }, ] //Receive information about the manufacturer from the customer// >Operations with Manufacturers > >GET /manufacturer Return all manufacturers - is used for returning information on Manufacturers from Client >{{:ru:api_17.png?750|}} > > > > ---- **Curl** curl -X 'POST' \ 'https://719.eu6.ysell.pro/api/v1/manufacturer' \ -H 'accept: */*' \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ -d '{ "id": 0, "name": "NewManufacturer" }' **Response body** { "id": 23, "name": "NewManufacturer" } //Manufacturer created "NewManufacturer"// > >POST /maufacturer Create new Manufacturer > >Enter a name of Manufacturer in the "Name" field. ID of Manufacturer will be assigned automatically. > >{{:ru:api_18.png?700|}} ---- **Curl** curl -X 'PUT' \ 'https://719.eu6.ysell.pro/api/v1/manufacturer/22' \ -H 'accept: */*' \ -H 'Authorization: Bearer 123321' \ -H 'Content-Type: application/json' \ -d '{ "id": 0, "name": "NewManufacturer2" }' **Response body** { "id": 22, "name": "NewManufacturer2" } //Updating the information about the manufacturer named "NewManufacturer2"// >PUT /manufacturer/{manufacturerID} Update Manufacturer - Updating the information about the manufacturer named "NewManufacturer2". > >manufacturerId - specify Manufacturer ID. >Specify the name of the Manufacturer in the "Name" field. > >{{:ru:api_19.png?700|}} ---- **Curl** curl -X 'DELETE' \ 'https://719.eu6.ysell.pro/api/v1/manufacturer/22' \ -H 'accept: */*' \ -H 'Authorization: Bearer ' //Deleting information about the manufacturer with ID "22"// >Delete /manufacturer/{manufacturerID} Delete Manufacturer > >{{:ru:api_20.png?700|}} ====== Marketplace ====== **Curl** curl -X 'GET' \ 'https://719.eu6.ysell.pro/api/v1/marketplace' \ -H 'accept: */*' \ -H 'Authorization: Bearer ' **Response body** [ { "id": 1, "country_code": "GB", "currency": "GBP", "marketplace_id": "A1F83G8C2ARO7P", "url": "https://amazon.co.uk", "created_at": null, "updated_at": null, "sales_channel": "amazon.co.uk", "region": "AMAZON_EU", "endpoint": "https://mws-eu.amazonservices.com", "domain_zone": "co.uk" }, ] >//Operations with marketplaces// > >GET /marketplace Return all marketplaces - Provides information about the connection to the customer marketplaces. > >{{:ru:api_21.png?600|}} > > > > > > > > ---- ====== Orders ====== >//Operations with orders// **Curl** curl -X 'GET' \ 'https://719.eu6.ysell.pro/api/v1/order?sort=o-719-67&page=1' \ -H 'accept: */*' \ -H 'Authorization: Bearer ' > >Get /order Returns order - is used to receive information about the order. > >{{:ru:api_22.png?600|}} ---- **Curl** curl -X 'POST' \ 'https://719.eu6.ysell.pro/api/v1/order' \ -H 'accept: */*' \ -H 'Authorization: Bearer 123321' \ -H 'Content-Type: multipart/form-data' \ -F 'buyer_state=' \ -F 'buyer_phone_number=+49 421 668 9414 0' \ -F 'payment_date=2022-04-30' \ -F 'status_id=' \ -F 'buyer_country=DE' \ -F 'purchase_date=2022-04-30' \ -F 'ship_state=' \ -F 'ship_city=Bremen' \ -F 'ship_name=Gomez' \ -F 'buyer_email=gomez@gmail.com' \ -F 'currency=' \ -F 'platform=amazon' \ -F 'ship_country=DE' \ -F 'buyer_addr1=Walter-Geerdes-Str' \ -F 'buyer_postal_code=28307' \ -F 'buyer_addr2=Walter-Geerdes-Str' \ -F 'buyer_city=Bremen' \ -F 'buyer_name=Gomez' \ -F 'platform_order_id=Amazon-1' \ -F 'latest_ship_date=2022-04-30' \ -F 'ship_email=info@fulfillment-box.de' \ -F 'id=' \ -F 'company_id=719' \ -F 'ship_phone_number=+49 421 668 9414 0' \ -F 'ship_addr1=Walter-Geerdes-Str' \ -F 'ship_addr2=14' \ -F 'ship_postal_code=28307 ' >POST /order Create new order - is used for the creation of a new order. > >id - order ID. If the box "Send empty value" is checked, the ID is generated automatically. > >status_id - [[en:orderdescription|Status order ID]]. Check "Send empty value" box to set status automatically. > >company_id - [[en:comp|Company ID]] on ysell.pro. > >platform - Platform used for order creation. > >platform_order_id - Order ID on the platform. > >purchase_date - Order purchase date. > >payment_date - Order payment date. > >latest_ship_date - The last period for sending the order. > >currency - Currency. > >ship_name - Recipient name. > >ship_email - Recipient e-mail address. > >ship_addr1 - Recipient address. > >ship_city - Recipient City. > >ship_postal_code - Recipient Postal Code. > >ship_country - Recipient Country. > >ship_phone_number - Recipient phone number ---- **Curl** curl -X 'GET' \ 'https://719.eu6.ysell.pro/api/v1/order/75' \ -H 'accept: */*' \ -H 'Authorization: Bearer ' //Get information about the order with ID 75// >GET /order/{ID} Return order by ID - is used for return information on the order > >ID - indicate order ID > > {{:ru:api_25.png?600|}} ---- **Curl** curl -X 'DELETE' \ 'https://719.eu6.ysell.pro/api/v1/order/60' \ -H 'accept: */*' \ -H 'Authorization: Bearer ' //Deleting the order with ID 75// >Delete /order/{ID} Delete Order by ID - is used to delete orders. > >ID - enter order ID > >{{:ru:api_26.png?600|}} ---- **Curl** curl -X 'POST' \ 'https://719.eu6.ysell.pro/api/v1/order-item' \ -H 'accept: */*' \ -H 'Authorization: Bearer ' \ -H 'Content-Type: multipart/form-data' \ -F 'p_id=155' \ -F 'order_id=70' \ -F 'shipment_items_cost=20' \ -F 'qty=15' \ -F 'asin=TestAsin' \ -F 'id=' \ -F 'product_name=TestName' \ -F 'item_price=15' \ -F 'sku=TestSKU' **Response body** { "id": 147, "order_id": "70", "sku": "TestSKU", "qty": "15", "image": "https://719.eu6.ysell.pro/product_images/155/51yLgO1l4xL (1).jpg", "item_price": "15", "unit_price": null, "product_id": null, "item_type": "product" } //Adding a product to the order with ID 70// >Post /order-item Create new order item - is used for adding positions to the order. > >**order_id** - Enter order ID. > >**asin** - ASIN of the product. > >**p_id** - Product ID. > >**product_name** - Name of the product. > >**sku** - SKU of the product. > >**qty** - Quantity of product in the order. > >**item_price** - Price of a unit. >{{:ru:api_27.png?600|}} ---- ====== Shipments ====== >//Operations with shipments// **Curl** curl -X 'GET' \ 'https://719.eu6.ysell.pro/api/v1/prep-shipment?page=1&per-page=10&sort=1' \ -H 'accept: */*' \ -H 'Authorization: Bearer 123321' **Response body** { "id": 1, "company_id": 719, "shipment_num": "719-1", "shipment_type": "warehouse", "shipment_type_description": "Send to the warehouse", "status": 0, "status_description": "New", "total_cost": 0, "declared_qty": 211, "declared_box_qty": 0, "processed_qty": 0, "messages": [] }, //Information about shipment 719-1// >**GET /prep-shipment Get prep shipment list** - is used to receive information about the shipment from the Prep Center. > >**company_id** - Company ID. > >**shipment_num** - Number of the shipment. > >**shipment_type** - Type of the shipment. > >**shipment_type_description** - Description of the shipment type. > >**status** - Status of the shipment. > >**status_description** - Description of the shipment status. > >**total_cost** - Price for processing the shipment. > >**declared_qty** - Quantity of product units specified by the customer. > >**declared_box_qty** - Number of cartons with the product specified by the customer. > >**processed_qty** - Quantity of product processed by the Prep Center. > >**messages** - Dispatch notification.