Add Bulk Products to PriceBook
Use this operation to add an existing Products object to a Pricebook.
Parameters
Body Params | |
---|---|
JSON: | json Product Pricebook details needs to be passed as body parameter,it should be in JSON format. |
XML: | string Product Pricebook details needs to be passed as body parameter,it should be in XML format. |
Path Params | |
---|---|
yourCompany: | string The Company name need to passed in the base URL.For eg. if you enter xyzcompany name, the url https://{yourCompany}.agiliron.net/agiliron/api-40.php/Bulk-ProductsPriceBook will change to https://xyzcompany.agiliron.net/agiliron/api-40.php/Bulk-ProductsPriceBook |
callback_url | string The callback URL need to passed in the base URL , which means after the code execution this file gets called.For eg. https://abc.php, the url https://{yourCompany}.agiliron.net/agiliron/api-40.php/Bulk-ProductsPriceBook?callback_url=https://abc.php&key=xyzkey In this case after execution of code the curl call will made on https://abc.php. |
sendRecordNo | string The value as true or false need to passed for this parameter in the base URL.For eg. if you want record number with response then send value as true ,For eg. https://xyzcompany.agiliron.net/agiliron/api-40.php/Bulk-ProductsPriceBook&key=xyzkey&sendRecordNo=true. By default it will be false. |
Header Params | |
---|---|
Accept: | string Response header need to be passed for eg. application/json or application/xml. |
Query Auth | |
---|---|
key: | string API key needs to be passed in this variable.The option to enter API key will appear when you click on Try it button.This will be the first option in AUTHENTICATION block.Default is SET to 0. |
Header Auth | |
---|---|
apiKey: | string Dedicated API key needs to be passed in this variable via header.The option to enter API key will appear when you click on Try it button.This will be the second option in AUTHENTICATION block.Default is SET to 0. |
Sample Code
{
"ProductPricebooks": {
"ProductPricebook": [
{
"ProductCode": "TNP1",
"PriceBook": "Retail - OAK1",
"Price": "55"
},
{
"ProductCode": "TNP2",
"PriceBook": "Bargains",
"Price": "44"
}
]
}
}
<ProductPricebooks>
<ProductPricebook>
<ProductCode>TNP1</ProductCode>
<PriceBook>Retail - OAK1</PriceBook>
<Price>55</Price>
</ProductPricebook>
<ProductPricebook>
<ProductCode>TNP2</ProductCode>
<PriceBook>Bargains</PriceBook>
<Price>44</Price>
</ProductPricebook>
<ProductPricebooks>
Sample Response
{
"MCM": {
"response": {
"objectType": "Products",
"syncTime": "2021-06-11 04:13:24"
},
"parameters": {
"results": {
"message": {
"status": "Success",
"success_message": "Bulk Product Pricing Initiated Successfully.",
"batch_id": "thggii1212kjkl"
}
}
}
}
}
<MCM>
<response>
<objectType>Products</objectType>
<syncTime>2021-06-11 04:13:24</syncTime>
</response>
<parameters>
<results>
<message>
<status>Success</status>
<success_message> Bulk Product Pricing Initiated Successfully. </success_message>
<batch_id>thggii1212kjkl</batch_id>
</message>
</results>
</parameters>
</MCM>
WADL
<?xml version="1.0" encoding="utf-8"?>
<application>
<resources base="https://{yourCompany}.agiliron.net/agiliron/api-40/">
<resource path="Bulk-ProductsPriceBook">
<method name="POST">
<request>
<param name="key" type="xsd:string" style="query" required="true"/>
<param name="ProductCode" type="xsd:string" style="body" required="true"/>
<param name="PriceBook" type="xsd:string" style="body" required="true"/>
<param name="Price" type="xsd:decimal" style="body"/>
</request>
<response status="200">
<representation mediaType="application/xml" element="yn:ResultSet"/>
</response>
<response status="400">
<representation mediaType="application/xml" element="ya:Error"/>
</response>
</method>
</resource>
</resources>
</application>
Sample Webhook
<?php
$url = "https://{your_custom_url}"; //this custom url will be called after the code is executed
$curlConn = curl_init();
curl_setopt($curlConn, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curlConn, CURLOPT_POSTFIELDS,$results); //$results contain the result set
curl_setopt($curlConn,CURLOPT_URL,$url);
curl_setopt($curlConn, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curlConn, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curlConn, CURLOPT_RETURNTRANSFER, 1);
$ret = curl_exec($curlConn);
?>
<result>
<SuccessNumber>1</SuccessNumber>
<FailureNumber>1</FailureNumber>
<Success>
<ProductPriceBook>
<ProductCode>TNP1234</ProductCode>
<PriceBook>Pricebook 1</PriceBook>
<Price>20</Price>
</ProductPriceBook>
</Success>
<Failure>
<ProductPriceBook>
<ProductCode>TNP123</ProductCode>
<PriceBook>Pricebook 2</PriceBook>
<Message>Invalid PriceBook name</Message>
</ProductPriceBook>
</Failure>
</result>
{
"result": {
"SuccessNumber": "1",
"FailureNumber": "1",
"Success": {
"ProductPriceBook": {
"ProductCode": "TNP1234",
"PriceBook": "Pricebook 1",
"Price": "20"
}
},
"Failure": {
"ProductPriceBook": {
"ProductCode": "TNP123",
"PriceBook": "Pricebook 2",
"Message": "Invalid PriceBook name"
}
}
}
}
<result>
<SuccessNumber>1</SuccessNumber>
<FailureNumber>1</FailureNumber>
<Success>
<ProductPriceBook>
<ProductCode>TNP1234</ProductCode>
<PriceBook>Pricebook 1</PriceBook>
<Price>20</Price>
<Record>1</Record>
</ProductPriceBook>
</Success>
<Failure>
<ProductPriceBook>
<ProductCode>TNP123</ProductCode>
<PriceBook>Pricebook 2</PriceBook>
<Message>Invalid PriceBook name</Message>
<Record>2</Record>
</ProductPriceBook>
</Failure>
</result>
{
"result": {
"SuccessNumber": "1",
"FailureNumber": "1",
"Success": {
"ProductPriceBook": {
"ProductCode": "TNP1234",
"PriceBook": "Pricebook 1",
"Price": "20",
"Record": "1"
}
},
"Failure": {
"ProductPriceBook": {
"ProductCode": "TNP123",
"PriceBook": "Pricebook 2",
"Message": "Invalid PriceBook name",
"Record": "2"
}
}
}
}
Updated over 1 year ago