WAPI – command poll-req

Getting notifications from POLL queue is performed by a combination of commands poll-req and poll-ack. Description of notifications system, you can find here WAPI – notifications. It is always necessary to download notification, then indicate as accepted and make available any other. Notifications are always returned from oldest to newest.

Parameters

This command does not accept any parameters.

Return Values

  • 1000 – notification obtained
  • 1003 – in the queue is not any unread notification
  • 2150 – download queue notifications from poll is not set in your account  

Return data

If there is any notification for download, it is returned in node notify with the following internal structure:

  • code – return value of the command
  • result – text description of the return value
  • timestamp – notification creation time 
  • clTRID – client query id 
  • svTRID – internal query id
  • command – command
  • id – notification id(for use in poll-ack)

Example 1: obtaining notification

XML request:

<request>
 <user>tester</user>
 <auth>202b62bb4646281f97d225db1249840c8452dd8f</auth>
 <command>poll-req</command>
 <clTRID>LtVxXV9wLSWw</clTRID>
</request>

XML response:

<response>
 <code>1000</code>
 <result>OK</result>
 <timestamp>1286962195</timestamp>
 <clTRID>LtVxXV9wLSWw</clTRID>
 <svTRID>1286962195.3105.9108.1</svTRID>
 <command>poll-req</command>
 <data>
  <notify>
   <code>1000</code>
   <result>OK</result>
   <timestamp>1286957040</timestamp>
   <clTRID>RKUFhhe5q8qw</clTRID>
   <svTRID>1286957032.2043.21543</svTRID>
   <command>ping-async</command>
   <id>2691</id>
  </notify>
 </data>
</response>

Example 2: empty notifications queue

XML request:

<request>
 <user>tester</user>
 <auth>202b62bb4646281f97d225db1249840c8452dd8f</auth>
 <command>poll-req</command>
 <clTRID>qQn32fUNTsfN</clTRID>
</request>

XML response:

<response>
 <code>1003</code>
 <result>Empty notifications queue</result>
 <timestamp>1286962852</timestamp>
 <clTRID>qQn32fUNTsfN</clTRID>
 <svTRID>1286962852.1843.9155.1</svTRID>
 <command>poll-req</command>
</response>