Supplier Frontend M2 - API Methods
API Methods
Introduction
API, an abbreviation of Application Program Interface, is a set of routines, protocols, and tools dedicated to building software applications.
A good API makes it easier to develop a program by providing all the building blocks. This is an advanced guide that considers you have development knowledge.
What You Need
The user has to login on frontend and navigate to My Account → Vendor Portal → Settings → API.
Table of Contents
Methods (SOAP API V2)
The CreativeMinds Magento® Supplier Front-end and Multi-Vendor Marketplace extensions support the following methods:
getAttributeSetList
Usage: Gets the list of all available attribute sets (the attribute set ID is taken from here)
Route: cmindsSupplierfrontendproductuploaderSupplierProductV1GetAttributesSetList
Request Fields
Type | Name | Description |
---|---|---|
string | $userAccessToken | Token generated in personal account |
Type | Name | Description |
---|---|---|
\Magento\Eav\Api\Data\AttributeSetSearchResultsInterface |
$result | Gets the list of all available attribute sets (the attribute set ID is taken from here) |
getAttributesList
Usage: Gets the list of available attributes that can be used for product creation
Route: cmindsSupplierfrontendproductuploaderSupplierProductV1GetAttributesList
Arguments
Type | Name | Description |
---|---|---|
string | userAccessToken | Token generated in personal account |
Response
Type | Name | Description |
---|---|---|
\Magento\Eav\Api\Data\AttributeSearchResultsInterface |
$result | Gets the list of available attributes that can be used for product creation |
getCategoryList
Usage: Gets the list of available categories ID
Route: cmindsSupplierfrontendproductuploaderSupplierProductV1getCategoryList
Arguments
Type | Name | Description |
---|---|---|
string | userAccessToken | Token generated in personal account |
Response
Type | Name | Description |
---|---|---|
Magento\Catalog\Api\Data\CategorySearchResultsInterface |
$result | Gets the list of available categories ID |
saveProducts
Usage: Saves or updates existing products. Only user assigned products can be updated.
When updating a product you need to send all required field values
Route: cmindsSupplierfrontendproductuploaderSupplierProductV1saveProducts
Arguments
Type | Name | Description |
---|---|---|
string | userAccessToken | Token generated in personal account |
various | \Cminds\Supplierfrontendproductuploader\Api\Data\SupplierProductInterface[] $products | Some are obligatory. Check below |
Response
Type | Name | Description |
---|---|---|
\Cminds\Supplierfrontendproductuploader\Api\Data\ResultInterface[] |
$result | Consists of 2 arrays. One contains the SKU of successfully processed products. The second one contains errors. |
createConfiguration
Usage: Creates a simple product and associates it to a configurable product. Important: in this case, the sku field contains the parent product sku
Route: cmindsSupplierfrontendproductuploaderSupplierProductV1createConfiguration
Arguments
Type | Name | Description |
---|---|---|
string | userAccessToken | Token generated in personal account |
various | \Cminds\Supplierfrontendproductuploader\Api\Data\SupplierConfigurationInterface[] $products |
Response
Type | Name | Description |
---|---|---|
\Magento\Eav\Api\Data\AttributeSearchResultsInterface |
$result | Gets the list of available attributes that can be used for product creation |
Product Fields
Type | Name | Example | Description/Note |
---|---|---|---|
Integer | 'sku' | '100003' | Obligatory for saveProducts |
String | 'name' | 'product 3' | Obligatory for saveProducts |
Integer | 'weight' | 11 | |
Integer | 'attributeSetId' | 16 | Obligatory for saveProducts |
Integer | 'price' | 555 | Obligatory for saveProducts |
String | 'description' | 'test description value' | Obligatory for saveProducts |
String | 'shortDescription' | 'test short description value' | Obligatory for saveProducts |
Integer | 'specialPrice' | '' | |
Date | 'specialPriceFrom' | '03/11/2020' | |
Date | 'specialPriceTo' | '03/21/2020' | |
Integer | 'qty' | 777 | Obligatory for saveProducts |
String | 'typeId' | 'configurable' | Supports only 'simple' and 'configurable' values Obligatory for saveProducts |
Integer Array | 'categories' | [2,4] | Obligatory for saveProducts |
Array | 'mediaGallery' | ['https://www.test.com/2015/02/logo-dark.png', 'https://www.test.com/2015/01/logo.png'] |
Array with links to images. Images can only be added, not updated |
Array |
'variationAttributes' | ['red','big'] |
Array with color and size attributes. Needed only for configurable products. |
Array | 'customAttributes' | ['attributeCode' => 'custom_attribute_code1', 'value' => 5478], ['attributeCode' => 'custom_attribute_code2', 'value' => 5112], |
|
Arguments - Example With All Possible Fields
Obligatory fields in saveProduct are highlighted
[
' sku' => '100003',
' name' => 'product 3',
' weight' => 11,
' attributeSetId' => 16,
' price' => 555,
' description' => 'test description value',
' shortDescription' => 'test short description value',
'specialPrice' => '',
'specialPriceFrom' => '03/11/2020',
'specialPriceTo' => '03/21/2020',
' qty' => 777,
' typeId' => 'configurable',
' categories' => [2,3],
'mediaGallery' => [
'https://www.test.com/2015/02/logo-dark.png',
'https://www.test.com/2015/01/logo.png'
],
'variationAttributes' => [
'color',
'size'
],
'customAttributes' => [
[
'attributeCode' => 'custom_attribute_code1',
'value' => 5478
],
[
'attributeCode' => 'custom_attribute_code2',
'value' => 5112
],
[
'attributeCode' => 'custom_attribute_code3',
'value' => 'custom attribute text value'
]
]
]
Connecting
To connect to Magento SOAP web services®, enter either of these paths. That way you should load the WSDL into your SOAP client. Remember to replace magentohost with the relevant address.
- http://magentohost/api/?wsdl
- http://magentohost/api/soap/?wsdl
For a more in-depth guide on Magento® SOAP API and how to connect to it, you can refer to the official guide on the subject.
Get more information about the Multi-Vendor Marketplace Extension for Magento. Find other Magento products at the CreativeMinds Magento Store. |
|
Let us know how we can Improve this Product Documentation Page. To open a Support Ticket visit our support center. |