Изменения

Перейти к: навигация, поиск

API Documentation

982 байта добавлено, 09:57, 11 декабря 2020
м
Fair Usage Policy
Due to [https://ru.wikipedia.org/wiki/XML#.D0.A0.D0.B5.D1.88.D0.B5.D0.BD.D0.B8.D0.B5_.D0.BF.D1.80.D0.BE.D0.B1.D0.BB.D0.B5.D0.BC.D1.8B_.D0.BD.D0.B5.D0.BE.D0.B4.D0.BD.D0.BE.D0.B7.D0.BD.D0.B0.D1.87.D0.BD.D0.BE.D1.81.D1.82.D0.B8_.D1.80.D0.B0.D0.B7.D0.BC.D0.B5.D1.82.D0.BA.D0.B8 the peculiarities of XML extensible markup language], some symbols in the text should be replaced: & from &amp;amp; < to &amp;lt; > from &amp;gt; " to &amp;quot;
== Limitations Fair Usage Policy ==With the aim of protecting service from its improper use query limitation equal to 1500 queries from one IP-address for 20-minute period has been introduced since May 29, 2017. In case the above-mentioned limit is reached, the IP-address will be blocked; unblocking of the IP-address is possible by addressing the technical support service with the subsequent discussion of your algorithms and their correction.
The best option for checking your orders` status is using "To protect our service from improper use and DDoS attacks, we have defined fair usage levels: * 30 tracking queries from a single IP address per 1 minute (use <code>statusreq" </code>).* 150 queries from a single IP address per 1 minute.* 1500 queries from a single IP address per 20 minutes.* 3000 queries with changes=ONLY_LAST parameterfrom a single account per 1 hour.* 200 MB text data downloaded per 3 hours. You shouldn`t try  If a limit is exceeded, the IP address is blocked for up to “attack” 3 hours. Actions that result in blocking your IP address or account: * Attacking our API with status queries containing with numbers of all your you orders, especially, with ". Mind that the <code>tracking" </code> queries – they are not intended to be used for this (that, see their [[API documentation#Order tracking by number|description)]]. These queries are especially bad at the top of the hour.* Sending queries like "Show statuses of all orders for the last 3 months" every 5 minutes. Correct actions: * To check order statuses, use <code>statusreq</code> queries with parameter <code>changes=ONLY_LAST</code>.* When requesting for changed statuses, you must confirm that the statuses were sucessfully received by query <code>commitlaststatus</code>.
== Ordering ==
<town>Saint-Petersburg</town>
<address>Room 35, 38 Petrovka Str.</address>
<date>March 2014-03-22, 2014</date>
<time_min>09:00</time_min>
<time_max>14:00</time_max>
*'''inshprice''' is a declared value.
*'''instruction''' is an instruction – a note.
*'''pvz''' is a pick-up point an order points of issue code. You can find out pick-up point the codes on request [[#The list of order points of issue|by the API requset]] or in user`s member area on “pvz” tab.
*'''department''' is the name of the department which the order is raised in.
*'''pickup''' is YES/NO attribute of pickup arrangement. If there is YES, then the entire order will be considered to be the assignment for cargo pickup but not for cargo delivery! It is applied for calling a courier to the receiver for the pickup of other packaging units.
:* '''''extcode''''' is an external code of a string. It is used for the identification of strings of orders when obtaining statuses. It is an optional field. IT IS NOT SUPPORTED YET.
In case it is necessary to specify them besides product units, additional services (for example, DELIVERY, order batching, lifting the order up to the floor, etc.) – they should be specified in the same “items” container as product units but without article numbers.
=== Examples of responses ===
<done>ONLY_NOT_DONE</done>
<changes>ONLY_LAST</changes>
<quickstatus>NO</quickstatus>
</statusreq>
</source>
*'''changes''' can have only one value - ONLY_LAST. If this parameter is set, all other parameters, except quickstatus, will be ignored. The description of this mode is given here: [[#Newly changed statuses transfer|Newly changed statuses transfer]]
 
*'''quickstatus''' indicates the “depth” of transferred statuses: "YES" value (by default) - statuses are transferred starting from the information provided by a courier. Such statuses are quick (as a rule, they are provided by a courier immediately after delivery) but not always accurate. "NO" value prohibits status transfer according to oral information provided by the courier and provides only those statuses that have been entered by an operator manually, as a rule. It takes more time however the level of accuracy is much higher in this case. It is not recommended to combine (interleave) these two types of status transfer in case of newly changed statuses demand as in this case the system will consider that statuses of dispatches are changing.
<?xml version="1.0" encoding="UTF-8"?>
<statusreq count="23">
<order orderno="111111" awb="qwerty" orderno2="123123" ordercode="34534234" givencode="2345334">
<barcode>111111</barcode>
<sender>
* ''order'' container attributes:
:* '''''awb''''' is a courier company related waybill number.
:* '''''orderno2''''' is an order number from the urgent delivery subsystem.
:* '''''ordercode''''' is an internal code of the order in the system which is applied for some internal operations.
:* '''''givencode''''' is an internal code of the order in the system which is applied for some internal operations.
 
* '''''code''''' attribute of '''item''' container is an internal code of order string in the system which is applied for some internal operations.
:* '''''returns''''' is the amount of a certain product unit which a receiver has refused. It will have a non-zero value only in case of a partial refusal.
* '''''code''''' attribute of '''item''' container is an internal code of order string in the system which is applied for some internal operations.
* '''''coords''''' in '''receiver''' container indicates receiver position.
* '''currcoords''' indicates current order position. Its attributes are:
<br />
== Order tracking by its number ==
Query for order tracking by number is intended to provide minimal anonymized information about a certain order to a non-authorized user. Our system has its own interface for this which is available at the following URL: "home.courierexe.ru/{extra code}/tracking". You can either create a link to such page at your web-site or put as an iframe there or create your own page and use our API. This interface is specially designed to issue information to a human web-site user. You need to use "statusreq" query, desirably with changes=ONLY_LAST parameter in order to obtain statuses of orders into your information system!
<order orderno="1234">
<sender>
<town code="1" country="RU">Moscow city</town>
<date></date>
</sender>
<receiver>
<town code="1" country="RU">Moscow city</town>
<date>2015-04-18</date>
</receiver>
<AWB>BarCode</AWB>
<weight>0</weight>
<quantity>1</quantity>
<currcoords lat="" lon="" accuracy="" RequestDateTime="" />
<status eventstore="Saint-Petersburg branch" eventtime="2016-06-02 17:22:00" createtimegmt="2016-06-03 16:14:44" message="" title="Delivered" country="RU">COMPLETE</status>
<statushistory>
<status eventstore="Moscow office" eventtime="2016-05-30 10:20:00" createtimegmt="2016-06-03 16:14:44" message="" title="New" country="RU">NEW</status> <status eventstore="Moscow office" eventtime="2016-06-01 17:38:00" createtimegmt="2016-06-03 16:14:44" message="Saint-Petersburg branch" title="Dispatch is planned" country="RU">DEPARTURING</status> <status eventstore="Moscow office" eventtime="2016-06-01 19:53:00" createtimegmt="2016-06-03 16:14:44" message="Saint-Petersburg branch" title="Dispatched from the warehouse" country="RU">DEPARTURE</status> <status eventstore="Saint-Petersburg branch" eventtime="2016-06-02 07:41:00" createtimegmt="2016-06-03 16:14:44" message="" title="Received by the warehouse" country="RU">ACCEPTED</status> <status eventstore="Saint-Petersburg branch" eventtime="2016-06-02 09:17:00" createtimegmt="2016-06-03 16:14:44" message="" title="Given to the courier to be delivered" country="RU">DELIVERY</status> <status eventstore="Saint-Petersburg branch" eventtime="2016-06-02 17:22:00" createtimegmt="2016-06-03 16:14:44" message="" title="Delivered (to be confirmed)" country="RU">COURIERDELIVERED</status> <status eventstore="Saint-Petersburg branch" eventtime="2016-06-02 17:22:00" createtimegmt="2016-06-03 16:14:44" message="" title="Delivered" country="RU">COMPLETE</status>
</statushistory>
</order>
</source>
The function is searching searches for the last order among the orders of all customers by its number(AWB or orderno). It provides anonymized information on a current state of the order. <br />
The description of response containers is similar to the description of [[API#.D0.97.D0.B0.D0.BF.D1.80.D0.BE.D1.81_.D1.81.D1.82.D0.B0.D1.82.D1.83.D1.81.D0.B0_.D0.B7.D0.B0.D0.BA.D0.B0.D0.B7.D0.BE.D0.B2|Order status query]].
 
== Status change by agent ==
If necessary, images can be attached to the order information.
'''The example of a status change responserequest:'''
<source lang="xml">
<?xml version="1.0" encoding="UTF-8" ?>
<order ordercode="234567" error="59" errormsg="value [date_put] is already set" errormsgru="The value [Date of delivery] is already set" />
</setorderinfo>
</source>
 
== Obtaining the pdf waybill ==
 
'''Request example:'''
<source lang="xml">
<?xml version="1.0" encoding="UTF-8" ?>
<waybill>
<auth extra="8" login="login" pass="pass" />
<orderno>1234567</orderno>
<form>1</form>
</waybill>
</source>
 
'''The fields description:'''
 
'''waybill''' - is a root container. It is a mandatory element.
*'''auth''' - is authorization. It is a mandatory element.
*'''orderno''' - Order number. It is a mandatory element.
*'''form''' - Form type. Is not mandatory. Can be:
:* 1 - A detailed waybill
:* 2 - Sticker (Zebra)
 
 
'''Response example:'''
<source lang="xml">
<?xml version="1.0" encoding="UTF-8"?>
<waybill>
<content>EODIcaI8KSBlwQ 4MnEOR7Px8U8EBAyGICBnwpw
IZhQgz0ZxuPs8EBM/GcbjzB AwhBl8hwQYIO00GmEwg1CeEG
mqYTChNU0wqf8l8nz4zgc+K fCno+zwU5GjOZmzXGcbEQYIM
4zkegRE40zWzONyoNNMIOIa cWnp6aDCGEGE9NQmoQd2mg00
79U4f3hPTwnfp6Sdrafeqpa JDpFw/1aYT077VNNNdO00G3q
mqqvp9p2E7T0/wiFemv8uG6 OM</content>
</waybill>
</source>
The '''''content''''' tag contains pdf binary, base64 encoded.
== Cancellation of order ==
*'''reserved''' is the number of goods reserved. It may outnumber stock balance if customers are waiting for the next delivery. ''This field may be unavailable in some setups.''
== The list of pick-up order points of issue ==
'''The example of a pick-points of issue query:'''
<source lang="xml">
<?xml version="1.0" encoding="UTF-8" ?>
</source>
*'''code''' is a code of a pick-up point in the system. It is used in an [[API#Ordering|ordering]] query.*'''clientcode''' is a code of a pick-up point used by a contracting company. *'''name''' is a name of a pick-up point. *'''address''' is a pick-up point`s address. *'''phone''' are pick-up point phone numbers. *'''comment''' is additional information.
== The list of types of priority ==

Навигация