TABLE OF CONTENTS
1 OVERVIEW
The Sync API Message Server facilitates communication between third party systems and Sync via a SOAP web service messaging layer. The service validates and processes request messages, executes the request in Sync and returns response messages to the caller.
To invoke an operation on the web service, a request message needs to be created containing the relevant criteria to query or persist data, depending on the requirement. The request message is made up of two parts: the header fields and the body field (MessageXml) which is serialized as an XML string.
The message server will always return a response message in correlation to a request. If the requested operation was successfully executed, a response message with a Resultflag of true and ResponseText of “OK” will be returned to the caller. An error will return a false Resultflag and a ReponseText containing the full details of the error, which may include exception details.
The API contains two methods, Login and Execute. The Login method is used to retrieve a Session Key. This session key will be used with each Execute method request. The session key will not expire with time, but each Login request will generate a new Session Key, invalidating all prior Session Keys. It is recommended that a new session key is requested before calling each Execute method.
The Execute method is used to retrieve or create objects from Sync. The Operation parameter in the Execute method is used to determine what object will be created or retrieved.
2 METHODS
2.1 LOGIN
Communication with the message server is authenticated by the Login method, which provides a response containing a Session Key, this Session Key is required for all further requests.
Request
Fields | Data Type | Note |
---|---|---|
Username | string | Provided by iSync |
Password | string | Provided by iSync |
Response
Fields | Data Type | Note |
---|---|---|
LoginResult | string | Session Key to use when calling other methods |
PHP Sample
$endpoint='http://integration.mydomain.co.za/SyncAPI/MessageService.svc?wsdl';
$user='webstore';
$pass='A05E63A';
$client=new SoapClient($endpoint, array('trace' => 1));
$loginObject = new stdClass();
$loginObject->username = $user;
$loginObject->password = $pass;
$loginResult = $client->Login($loginObject);
$session_token=$loginResult->LoginResult;
2.2 EXECUTE
Operations are invoked through the Execute method. The execute method requires a Request Message, where the structure is as follows:
Request
Fields | Data Type | Note |
---|---|---|
MessageType | string | Name of operation being invoked |
Identifier | string | |
Source | string | |
PublishDate | datetime | |
Instance | string | |
Action | string | Specifies the persistence action INSERT, UPDATE, DELETE, SELECT |
SessionKey | string | Session key provided by Login Method |
MessageXML | string | Serialised XML Message |
Response
Fields | Data Type | Note |
---|---|---|
MessageType | string | Same as correlating request's MessageType |
Identifier | string | Same as correlating request’s Identifier |
SuccessFlag | boolean | True if successful, false if not |
ResponseText | string | Result message, “OK” when successful, error / exception message on failure |
Source | string | Same as correlating request's Source |
PublishDate | datetime | Same as correlating request's PublishDate |
Instance | string | Same as correlating request's Instance |
Action | string | Same as correlating request's Action |
MessageXML | string | Serialised XML Message |
PHP Sample
$Details = new stdClass();
$Details->Action = 'OTHER';
$Details->Identifier = '1';
$Details->Instance = '1';
$Details->MessageType = 'GetProductStockCatalogue';
$Details->MessageXml='<ProductStockCatalogueQueryCriteria xmlns="http://schemas.datacontract.org/2004/07/iSync.EAI.DTO" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><AddedDate>2016-06-01T00:00:00</AddedDate></ProductStockCatalogueQueryCriteria>';
$Details->PublishDate = (new DateTime())->format('c');
$Details->SessionKey = $session_token;
$Details->Source = 'Magento';
$Request = new stdClass();
$Request->request = $Details;
try {$result = $client->Execute($Request);} catch (SoapFault $exception) {
var_dump($exception);
}
3 OPERATIONS
3.1 GETPRODUCTSTOCKCATALOGUE
This operation is used to retrieve a list of Sync SKUs including all the product fields published by the API. This method can use used to populate a catalogue on a website or to update SKU attributes. The operation will return SKUs that have had units change since the date given in the AddedDate parameter.
Request Criteria
Name | Type | Input | Comment |
---|---|---|---|
ProductStockCatalogueQueryCriteria | |||
AddedDate | DateTime | Required | Shows SKUs updated after date time |
AvailableUnits | bool? | Optional | Stock available to sell |
Request XML Example
<ProductStockCatalogueQueryCriteria xmlns="http://schemas.datacontract.org/2004/07/iSync.EAI.DTO" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <AddedDate>2016-01-01T00:00:00</AddedDate> </ProductStockCatalogueQueryCriteria> |
3.2 GETPRODUCTSTOCKUNITS
This operation is used to retrieve a list of Sync SKUs, showing available stock figures. The operation will return SKUs that have had units change since the date given in the AddedDate parameter. This operation is a more lightweight version of the getProductStockCatalogue and will only return the ProductStockID, SKU and Units fields.
Request Criteria
Name | Type | Input | Comment |
---|---|---|---|
ProductStockUnitsQueryCriteria | |||
AddedDate | DateTime | Required | Shows SKUs updated after date time |
AvailableUnits | bool? | Optional | Stock available to sell |
ThirdPartyBarcode | string | optional | Product Stock item barcodes (pipe delimited) |
Request XML Example
<ProductStockCatalogueUnitsCriteria xmlns="http://schemas.datacontract.org/2004/07/iSync.EAI.DTO" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <AddedDate>2016-01-01T00:00:00</AddedDate> </ProductStockUnitsQueryCriteria> |
3.3 PERSISTWEBSALESORDER
This operation is used to create a Sales Order in Sync.
Request Criteria
Name | Type | Required | Comment |
---|---|---|---|
WebSalesOrder | |||
Comments | string | No | |
DeliveryDetail | AddressDetail | Yes | |
DeliveryMethodID | int | No | i.e. Overnight express, Economy road freight |
IsGift | bool | No | Default = false |
LineItems | WebSalesOrderDetail[] | Yes | Array of sales order line items |
PONumber | string | Yes | Order # from website |
PaymentMethodID | int | No | |
PrintInvoice | Bool | No | Default = true |
RequiredDate | DateTime | Yes | |
SpecialInstructions | string | No | |
StatusID | int | Yes | Sales order header status code 1 - Pending 3 - Approved |
TrackNo | string | Yes | Web customer's website database ID |
AddressDetail | |||
AddressLine1 | string | Yes | |
AddressLine2 | string | No | |
AltNumber | string | No | |
City | string | No | |
Company | string | No | |
Country | string | No | |
string | No | ||
FullName | string | No | |
Mobile | string | No | |
Phone | string | No | |
PostCode | string | No | |
Province | string | No | |
WebSalesOrderDetail | |||
CNTypeID | int | Yes | 0 for stock item, > 0 for non-stock item |
Discount | decimal | No | Line Item Percentage Discount |
DueDate | DateTime | No | Defaults to current system date |
ExRate | decimal | Yes | Must be >= 0 |
SellingPrice | decimal | Yes | Must be >= 0 |
StatusID | int | Yes | Sales order line item status code 1 - Pending 3 - Approved |
ThirdPartyBarcode | string | Yes | |
Units | int | Yes |
Request XML Example
<WebSalesOrder xmlns="http://schemas.datacontract.org/2004/07/iSync.EAI.DTO" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <Comments/> <DeliveryDetail> <AddressLine1>10 Downing Street</AddressLine1> <AddressLine2>Westminster</AddressLine2> <AltNumber>08358798897</AltNumber> <City>London</City> <Company/> <Country>England</Country> <Email>[email protected]</Email> <FullName>John Doe</FullName> <Mobile>08358798897</Mobile> <Phone>08358798897</Phone> <PostCode>0007</PostCode> <Province>-</Province> </DeliveryDetail> <IsGift>false</IsGift> <LineItems> <WebSalesOrderDetail> <CNTypeID>0</CNTypeID> <Discount>0.00</Discount> <ExRate>1</ExRate> <SellingPrice>200</SellingPrice> <StatusID>3</StatusID> <ThirdPartyBarcode>ABSCLS2110_00000000000621</ThirdPartyBarcode> <Units>1</Units> </WebSalesOrderDetail> </LineItems> <PONumber>1000124</PONumber> <PaymentMethodID>0</PaymentMethodID> <PrintInvoice>true</PrintInvoice> <RequiredDate>2014-04-09T17:38:42</RequiredDate> <SpecialInstructions/> <StatusID>3</StatusID> <TrackNo>A1567516</TrackNo> </WebSalesOrder> |
3.4 GETWEBSALESORDER
This operation is used to retrieve a single sales order created via the API. Orders can be retrieved by using the PO Number as a parameter
Request Criteria
Name | Type | Input | Comment |
---|---|---|---|
WebSalesOrderQueryCriteria | |||
PONumber | string | Required | Specifies the PO Number of the sales order to lookup |
Request XML Example
<WebSalesOrderQueryCriteria xmlns="http://schemas.datacontract.org/2004/07/iSync.EAI.DTO" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <PONumber>081341987533</PONumber> </WebSalesOrderQueryCriteria> |
Response XML Example
<WebSalesOrder xmlns="http://schemas.datacontract.org/2004/07/iSync.EAI.DTO" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <Comments/> <DeliveryDetail> <AddressDetailID>28701</AddressDetailID> <AddressLine1>10 Downing Street</AddressLine1> <AddressLine2>Westminster</AddressLine2> <AltNumber/> <City>London</City> <Company/> <Country/> <Email>[email protected]</Email> <FullName>John Doe</FullName> <Mobile/> <Phone>08358798897</Phone> <PostCode>0007</PostCode> <Province>-</Province> <WarehouseID i:nil="true"/> </DeliveryDetail> <DeliveryMethodID>1</DeliveryMethodID> <EntitlementID>0</EntitlementID> <IsGift>true</IsGift> <IsXStock>true</IsXStock> <LineItems> <WebSalesOrderDetail> <CNTypeID>0</CNTypeID> <Comment/> <Commission>10.00</Commission> <Discount>0.00</Discount> <DueDate>2018-09-01T00:00:00</DueDate> <ExRate>1.0000</ExRate> <InvoiceDate i:nil="true"/> <InvoiceNumber/> <InvoiceReference/> <InvoiceSubCustomer>false</InvoiceSubCustomer> <InvoiceUnits>0.00</InvoiceUnits> <ProductStockID>0</ProductStockID> <Reference/> <SODetailID>136141</SODetailID> <SalesOrderID>33534</SalesOrderID> <SellingPrice>16.36</SellingPrice> <StatusID>11</StatusID> <ThirdPartyBarcode>999999999999</ThirdPartyBarcode> <Units>4.00</Units> </WebSalesOrderDetail> </LineItems> <PONumber>081341987533</PONumber> <PaymentMethodID>3</PaymentMethodID> <PrintInvoice>true</PrintInvoice> <RequiredDate>2018-09-01T00:00:00</RequiredDate> <SalesOrderID>33534</SalesOrderID> <SpecialInstructions/> <StatusID>11</StatusID> <TrackNo>TRACK</TrackNo> <WebCustomerName>John Doe</WebCustomerName> <WebSale>true</WebSale> </WebSalesOrder> |
3.5 CREATEWEBCREDITNOTE
This operation is used to create Pending Credit Notes in Sync.
Request Criteria
Name | Type | Required | Comment |
---|---|---|---|
WebCreditNote | |||
Comments | string | Required | Credit note header comment |
LineItems | ArrayOfWebCreditNoteDeail[] | Array of credit note line items | |
PONumber | string | Required | PO Number of the Sales Order |
Reference | string | Create note header reference | |
SalesOrderNumber | string | Required | Number of the Sales Order |
TrackNo | string | Required | Tracking Number of the Customer |
WebCreditNoteDetail | |||
CNTypeID | int | Required | 0 for stock item, >0 for non-stock item |
Comment | string | Line item comment | |
Discount | decimal | Line item discount percentage | |
ExRate | decimal | Required | Must be > 0 |
Rate | decimal | Required | Must be > 0 |
Reference | string | ||
SellingPrice | decimal | Required | Must be > 0 |
ThirdPartyBarcode | string | Required | |
Units | decimal | Required |
Request XML Example
<WebCreditNote xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/iSync.EAI.DTO"> <Comments>other</Comments> <LineItems> <WebCreditNoteDetail> <CNTypeID>0</CNTypeID> <Comment/> <Discount>0.00</Discount> <ExRate>1</ExRate> <Reference/> <SellingPrice>29.95</SellingPrice> <ThirdPartyBarcode>123123123123</ThirdPartyBarcode> <Units>1</Units> </WebCreditNoteDetail> <WebCreditNoteDetail> <CNTypeID>4</CNTypeID> <Comment/> <Discount>0</Discount> <ExRate>1</ExRate> <Reference/> <SellingPrice>1.25</SellingPrice> <ThirdPartyBarcode/> <Units>1</Units> </WebCreditNoteDetail> </LineItems> <PONumber>ON/21838</PONumber> <Reference>ST002087231-7899</Reference> <SalesOrderNumber>SO-00026552</SalesOrderNumber> <TrackNo>WEBCUSTOMER</TrackNo> </WebCreditNote> |
Response XML Example
<WebCreditNote xmlns="http://schemas.datacontract.org/2004/07/iSync.EAI.DTO" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <Comments>other</Comments> <LineItems> <WebCreditNoteDetail> <CNTypeID>0</CNTypeID> <Comment/> <Discount>0.00</Discount> <ExRate>1</ExRate> <Reference/> <SellingPrice>29.95</SellingPrice> <ThirdPartyBarcode>123123123123</ThirdPartyBarcode> <Units>1</Units> </WebCreditNoteDetail> <WebCreditNoteDetail> <CNTypeID>4</CNTypeID> <Comment/> <Discount>0</Discount> <ExRate>1</ExRate> <Reference/> <SellingPrice>1.25</SellingPrice> <ThirdPartyBarcode/> <Units>1</Units> </WebCreditNoteDetail> </LineItems> <PONumber>ON/21838</PONumber> <Reference>ST002087231-7899</Reference> <SalesOrderNumber>SO-00026552</SalesOrderNumber> <TrackNo>WEBCUSTOMER</TrackNo> </WebCreditNote> |