WAPI – notification

Some operations can not be performed immediately. In order to find out how this operation was done(eventually follow its course) system includes WAPI notifications.

So if you can not complete the operation immediately, the answer will be returned Request pending (1001). After the operation is complete (more complicated by the actions of the individual steps) is created a notification, which is similar to the classic response. According to the parameters clTRID, or svTRID you can easily identify which notification belongs to which request.

As notifications are not sent the results of requests that were made synchronously.

Data notifications are always in XML encoding in UTF-8.

Delivery of notification

There are three ways to deliver notification from us to you:

  1. Sending by e-mail
  2. Calling the URL address of your script and delivery over POST
  3. Download from the POLL queue

In the customer center in WAPI settings is necessary to choose one of these methods. By default, the is used POLL queue.

Sending by e-mail

After the operation is complete, the notification is sent to the e-mail address that you set in the customer center.

Calling the URL address

Notification is sent via HTTP (or HTTPS) protocol to the specified URL address by using the POST method in parameter request. The correct delivery is considered HTTP response with status code 200. When it fails to deliver, our system will try to deliver it again in a few minutes’ intervals.

Downloading from the POLL queue

In this case, all the notification is queued in our system and using the commands can be downloaded via the WAPI. In WAPI interface send command notify-poll-req. If the queue is empty, the system returns 1003 – Empty notifications queue, otherwise puts into response oldest not downloaded notification.

After getting the notification it should be marked as processed by using the command notify-poll-ack, which handing its ID. This way you can mark only the oldest not downloaded notification (returned by command poll_req).

Detailed description of these commands can be found here: notify-poll-reqnotify-poll-acq.

Example

XML request:

<request>
 <user>tester</user>
 <auth>fb82be1466331148816bdbac855a6b1bd4e24b81</auth>
 <command>ping-async</command>
 <clTRID>AvrX87Kqk6h3</clTRID>
</request>

XML response:

<response>
 <code>1001</code>
 <result>Request pending</result>
 <timestamp>1286957874</timestamp>
 <clTRID>AvrX87Kqk6h3</clTRID>
 <svTRID>1286957874.1271.15706</svTRID>
 <command>ping-async</command>
</response>

XML notification:

<notify>
 <code>1000</code>
 <result>OK</result>
 <timestamp>1286957932</timestamp>
 <clTRID>AvrX87Kqk6h3</clTRID>
 <svTRID>1286957874.1271.15706</svTRID>
 <command>ping-async</command>
 <ID>2691</ID>
</notify>