AddProductsToCategory
Adds items/products to a web category.Note: This request can participate in a transaction. Learn more about transactions.
Input Properties
AddProductsToCategoryRequest
Output Properties
AddProductsToCategoryResponse
Http Request
POST https://yourcompany-api.exigo.com/3.0/webcategory/product HTTP/1.1 Content-Type: application/json Authorization: Basic base64Encoded(yourlogin@yourcompany:yourpassword){ "webID": 1, "categoryID": 1, "itemCodes": null }
Http Response
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 Content-Length: length{ "categoryID": 1, "webID": 1, "result": null }
Soap Request
The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values.
POST /3.0/ExigoApi.asmx HTTP/1.1 Host: api.exigo.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "https://api.exigo.com/AddProductsToCategory" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header> <ApiAuthentication xmlns="http://api.exigo.com/"> <LoginName>string</LoginName> <Password>string</Password> <Company>string</Company> <Identity>string</Identity> <RequestTimeUtc>dateTime</RequestTimeUtc> <Signature>string</Signature> </ApiAuthentication> </soap:Header> <soap:Body> <AddProductsToCategoryRequest xmlns="http://api.exigo.com/"> <WebID>int</WebID> <CategoryID>int</CategoryID> <ItemCodes> <string>string</string> </ItemCodes> </AddProductsToCategoryRequest> </soap:Body> </soap:Envelope>
Soap Response
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <AddProductsToCategoryResult xmlns="http://api.exigo.com/"> <CategoryID>int</CategoryID> <WebID>int</WebID> </AddProductsToCategoryResult> </soap:Body> </soap:Envelope>
C# Rest Client
Install Nuget package Exigo.Api.Client
try
{
//Create Api Client
var api = new ExigoApiClient("yourcmpany", "yourlogin", "yourpassword");
//Create Request
var req = new AddProductsToCategoryRequest();
req.WebID = 1; //WebID used in content engine
req.CategoryID = 1;
//Add ItemCodes
var itemcodes = new List<String>();
itemcodes.Add("1");
itemcodes.Add("2");
//Now attach the list to the request
req.ItemCodes = itemcodes.ToArray();
//Send Request to Server and Get Response
var res = await api.AddProductsToCategoryAsync(req);
//Now examine the results:
Console.WriteLine("CategoryID: {0}", res.CategoryID);
Console.WriteLine("WebID: {0}", res.WebID);
}
catch (Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
}
C# Soap Client
try
{
//Create Main API Context Object
ExigoApi api = new ExigoApi();
//Create Authentication Header
ApiAuthentication auth = new ApiAuthentication();
auth.LoginName = "yourLoginName";
auth.Password = "yourPassword";
auth.Company = "yourCompany";
api.ApiAuthenticationValue = auth;
//Create Request
AddProductsToCategoryRequest req = new AddProductsToCategoryRequest();
req.WebID = 1; //WebID used in content engine
req.CategoryID = 1;
//Add ItemCodes
List<String> itemcodes = new List<String>();
itemcodes.Add("1");
itemcodes.Add("2");
//Now attach the list to the request
req.ItemCodes = itemcodes.ToArray();
//Send Request to Server and Get Response
AddProductsToCategoryResponse res = api.AddProductsToCategory(req);
//Now examine the results:
Console.WriteLine("CategoryID: {0}", res.CategoryID);
Console.WriteLine("WebID: {0}", res.WebID);
}
catch (Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
}
VB.Net
Try
'Create Main API Context Object
Dim api as new ExigoApi()
'Create Authentication Header
Dim auth as new ApiAuthentication()
auth.LoginName = "yourLoginName"
auth.Password = "yourPassword"
auth.Company = "yourCompany"
api.ApiAuthenticationValue = auth
'Create Request
Dim req as new AddProductsToCategoryRequest()
req.WebID = 1
req.CategoryID = 1
'Add ItemCodes
Dim itemcodes As New List(Of String)()
itemcodes.Add("1")
itemcodes.Add("2")
'Now attach the list to the request
req.ItemCodes = itemcodes.ToArray()
'Send Request to Server and Get Response
Dim res As AddProductsToCategoryResponse = api.AddProductsToCategory(req)
'Now examine the results:
Console.WriteLine("CategoryID: {0}", res.CategoryID)
Console.WriteLine("WebID: {0}", res.WebID)
Catch ex As Exception
Console.WriteLine("Error: " & ex.Message)
End Try
PHP
Note: PHP is not officially supported.<?php
try
{
//Setup the SoapClient and Authentication
$api = new SoapClient("http://api.exigo.com/3.0/ExigoApi.asmx?WSDL");
$ns = "http://api.exigo.com/";
$auth = array()
$auth["LoginName"] = new SoapVar("yourLoginName",XSD_STRING,null,null,null,$ns);
$auth["Password"] = new SoapVar("yourPassword",XSD_STRING,null,null,null,$ns);
$auth["Company"] = new SoapVar("yourCompany",XSD_STRING,null,null,null,$ns);
$headerBody = new SoapVar($auth, SOAP_ENC_OBJECT);
$header = new SoapHeader($ns, 'ApiAuthentication', $headerBody);
$api->__setSoapHeaders(array($header));
//Create Request
$req->WebID = 1;
$req->CategoryID = 1;
//Add ItemCodes
$itemCode1->Chars = 1;
$itemCode1->Length = 1;
$itemCode2->Chars = 2;
$itemCode2->Length = 2;
//Now attach the list to the request
req.ItemCodes = array(itemCode1,itemCode2);
//Send Request to Server and Get Response
$res = $api.AddProductsToCategory($req);
//Now examine the results:
}
catch (SoapFault $ex)
{
echo "Error: ", $ex->getMessage();
}
?>
Java
Note: Java is not officially supported.try
{
//Create Main API Context Object
ExigoApi api = new ExigoApi();
//Create Authentication Header
ApiAuthentication auth = new ApiAuthentication();
auth.setLoginName("yourLoginName");
auth.setPassword("yourPassword");
auth.setCompany("yourCompany");
api.setApiAuthenticationValue(auth);
//Create Request
AddProductsToCategoryRequest req = new AddProductsToCategoryRequest();
req.setWebID(1);
req.setCategoryID(1);
//Add ItemCodes
ArrayOfSystem.String itemcodes = new ArrayOfSystem.String();
String itemCode1 = new String();
itemCode1.setChars(1);
itemCode1.setLength(1);
itemcodes.Add(itemCode1);
String itemCode2 = new String();
itemCode2.setChars(2);
itemCode2.setLength(2);
itemcodes.Add(itemCode2);
//Now attach the list to the request
req.setItemCodes(itemcodes);
//Send Request to Server and Get Response
AddProductsToCategoryResponse res = api.getExigoApiSoap().addProductsToCategory(req, auth);
//Now examine the results:
}
catch (Exception ex)
{
System.out.println("Error: " + ex.getMessage());
}