Push notification


   

Some methods are asynchronous (all of POST/PUT methods for work with products and files), thus, it is impossible to get the job result in response. Push notification is used to solve this problem.

To sign for push notification of asynchronous methods results it is necessary to indicate callback URL to which the method implementation result will be sent.

There are two types of callback URLs available:

  • Success CallbackURL is used for information on successfully complete methods
  • Error CallbackURLis used for information on errors occurring during method implementation

If your system does not require separation of event handlers, you may use the same URL in both cases. Moreover, if you want to receive information only for erratic calls, you may indicate Error CallbackURL only.

Callback URL setting is made in merchant’s account at  merchants.ozon.ru, and if the site is not available yet, managers of Ozon.ru Trading platform may do it.

Data transferred during push notification have the same format as the initial request (application/xml or application/json).

In case of single invocation of asynchronous methods of API (POST/PUT methods of products resource) detailed information about the error shall be returned in push notification data (error code and description).

In case of batch processing (POST/PUT files) only general information about general processing status is returned in push notification:

  • complete, with errors ("State":"Failed")
  • partially complete, with errors (State":"PartiallyFailed")
  • complete, without errors ("State":"Successfull")

Push notification data structure:

<?xml version="1.0" encoding="utf-8"?>
<JobResult>
<Id></Id>
<ErrorData></ErrorData>
<ErrorCode></ErrorCode>
<InitRequest Method="" Uri="">
<ContentType></ContentType>
<Ip></Ip>
<HttpHeaders>
<HttpHeader></HttpHeader>
</HttpHeaders>
<Body></Body>
</InitRequest>
</JobResult>

See full example below.

In the <InitRequest> element the initial request to Merchants API is returned in full. In the <Body> element escaped body of initial request is written.

<ErrorData> and <ErrorCode> elements are used only if the processing is complete with error.

<?xml version="1.0" encoding="utf-8"?>
<JobResult>
<Id>102220</Id>
<ErrorData>Товар с SKU: TestSKU_Agiiuef_dd0 не существует</ErrorData>
<ErrorCode>40015</ErrorCode>
<InitRequest Method="PUT" Uri="https://api.ozon.ru/merchants/products/id">
<ContentType>application/xml</ContentType>
<Ip>10.17.32.74</Ip>
<HttpHeaders>
<HttpHeader Name="Connection">keep-alive</HttpHeader>
<HttpHeader Name="Accept">application/xml</HttpHeader>
<HttpHeader Name="Accept-Encoding">gzip,deflate,sdch</HttpHeader>
<HttpHeader Name="Accept-Language">en-US,en; q=0.8</HttpHeader>
<HttpHeader Name="Cookie">ttorder=1376053620962; ClientID=CZSSt4UcZz8=; s_cc=true; s_sq=%5B%5BB%5D%5D; s_intervReady=1406; s_ppv=47; s_intervLoad=2035</HttpHeader>
<HttpHeader Name="Host">alpha-wcf.qa.ozon</HttpHeader>
<HttpHeader Name="User-Agent">Mozilla/5.0,(Windows NT 6.1; WOW64),AppleWebKit/537.36,(KHTML, like Gecko),Chrome/28.0.1500.72,Safari/537.36</HttpHeader>
<HttpHeader Name="Origin">chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo</HttpHeader>
<HttpHeader Name="x-ApplicationId">superapp</HttpHeader>
<HttpHeader Name="x-Token">9895DDA48379484ABC51A4B193CDAE04</HttpHeader>
</HttpHeaders>
<Body Product MerchantSKU="TestSKU_Agiiuef_dd0" ProductTypeID="286495574000">
<SKU><Name>![CDATA[Aklpjqafsgj]]</Name></SKU>
<Price>
<SellingPrice>22</SellingPrice>
</Price>
</Product></Body>
</InitRequest>
</JobResult>