Поиск по сайту

API
Главная / API - Addresses

Addresses

Обновлено 21.10.2019
120 кб

General information

This service allows you to get the list of counterparty addresses, add and edit addresses in the list.

Addresses list

Method request

Request example

Method address: https://api.dellin.ru/v1/customers/book/addresses.json

{   
   "appkey":"00000000-0000-0000-0000-000000000000",
   "sessionID":"00000000-0000-0000-0000-000000000000",
   "counteragentID":"1"
}

Method address: https://api.dellin.ru/v1/customers/book/addresses.xml

<request>
   <appkey>00000000-0000-0000-0000-000000000000</appkey>
   <sessionid>00000000-0000-0000-0000-000000000000</sessionid>
   <counteragentid>1</counteragentid>
</request>

Description of parameters

Request
ParameterR*TypeDescription
appkeyYesstring

Application key. To get the key, register

sessionID

YesstringTo get the session ID, use the User Authorization method

counteragentID

Yesstring

ID of counterparty on which the list of addresses is required

Method response

Response example

[  
   {  
      "address":{  
         "id":"1",
         "type":"delivery",
         "cityID":"200601",
         "code":"7800000000002080000000000",
         "address":"190000, г. Санкт-Петербург, Васи Алексеева ул, д. 125 кв/оф. 513",
         "street":"Васи Алексеева",
         "house":"125",
         "building":"",
         "structure":"",
         "flat":"513",
         "contacts":2,
         "phones":4
      }
   },
   {  
      "address":{  
         "id":"2",
         "type":"juridical",
         "cityID":"7656",
         "code":"1600000100000790000000000",
         "address":"420000, Казань г (Респ. Татарстан), Мусы Бигиева ул, д. 122",
         "street":"Мусы Бигиева",
         "house":"122",
         "building":"",
         "structure":"",
         "flat":"",
         "contacts":1,
         "phones":2
      }
   },
   {  
      "address":{  
         "id":"3",
         "type":"delivery",
         "cityID":"73293",
         "code":"4000000100002180000000000",
         "address":"248031, Калуга г (Калужская обл.), Майская ул, д. 124",
         "street":"Майская",
         "house":"124",
         "building":"",
         "structure":"",
         "flat":"",
         "contacts":1,
         "phones":1
      }
   }
]
<response>
   <address>
      <id>1</id>
      <type>delivery</type>
      <cityid>200601</cityid>
      <code>7800000000002080000000000</code>
      <address>190000, г. Санкт-Петербург, Васи Алексеева ул, д. 125 кв/оф. 513</address>
      <street>Васи Алексеева</street>
      <house>125</house>
      <building></building>
      <structure></structure>
      <flat>513</flat>
      <contacts>2</contacts>
      <phones>4</phones>
   </address>
   <address>
      <id>2</id>
      <type>juridical</type>
      <cityid>7656</cityid>
      <code>1600000100000790000000000</code>
      <address>420000, Казань г (Респ. Татарстан), Мусы Бигиева ул, д. 122</address>
      <street>Мусы Бигиева</street>
      <house>122</house>
      <building></building>
      <structure></structure>
      <flat></flat>
      <contacts>1</contacts>
      <phones>2</phones>
   </address>
   <address>
      <id>3</id>
      <type>delivery</type>
      <cityid>73293</cityid>
      <code>4000000100002180000000000</code>
      <address>248031, Калуга г (Калужская обл.), Майская ул, д. 124</address>
      <street>Майская</street>
      <house>124</house>
      <building></building>
      <structure></structure>
      <flat></flat>
      <contacts>1</contacts>
      <phones>1</phones>
   </address>
</response>

Description of parameters

Response
ParameterTypeDescription
addressobjectInformation about the address
address.idstringAddress ID
address.typestring

Address type.

Possible values:

  • "delivery" - delivery address
  • "juridical " - juridical address
address.cityIDstringCity ID from the "Places" directory
address.codestring

CLADR* code of the street if it exists in directory. Otherwise, CLADR code of the city

*CLADR - Classifier of Addresses of Russian Federation

address.addressstringTextual representation of address
address.streetstringStreet
address.housestring

House (textual value)

address.buildingstringBuilding (numeric value)
address.structurestringStructure (numeric value)
address.flatstringApartmetn/office (textual value)
address.contactsintegerQuantity of contact persons for address
address.phonesintegerQuantity of contact phones for address

Address adding and editing

Address adding

Method request

Request example

Method address: https://api.dellin.ru/v1/customers/book/addresses/update.json

{
   "appkey":"00000000-0000-0000-0000-000000000000",
   "sessionID":"00000000-0000-0000-0000-000000000000",
   "counteragentID":"1",
   "street":"7800000000004380000000000",
   "house":"4",
   "building":"3",
   "structure":"лит. А",
   "flat":"214а"
}

Method address: https://api.dellin.ru/v1/customers/book/addresses/update.xml

<request>
   <appkey>00000000-0000-0000-0000-000000000000</appkey>
   <sessionid>00000000-0000-0000-0000-000000000000</sessionid>
   <counteragentid>1</counteragentid>
   <street>7800000000004380000000000</street>
   <house>4</house>
   <building>3</building>
   <structure>лит. А</structure>
   <flat>214а</flat>
</request>
Description of parameters
Request
ParameterR*TypeDescription
appkeyYesstringApplication key. To get the key, register

sessionID

YesstringTo get the session ID, use the User Authorization method

counteragentID

YesstringID of counterparty for which addition of the address is required
streetYesstring

CLADR code of the street.

It's possible to get CLADR code using the services presented on the page "Using CLADR codes"

houseYesstringHouse
buildingNostringBuilding
structureNostringStructure
flatNostringApartmetn/office
Notice: this method allows you to add the delivery address only. To add the juridical address, use Counterparties method.

If there is no code of the needed street in CLADR directory, request should be the next:

Request example

Method address: https://api.dellin.ru/v1/customers/book/addresses/update.json

{
   "appkey":"00000000-0000-0000-0000-000000000000",
   "sessionID":"00000000-0000-0000-0000-000000000000",
   "counteragentID":"1",
   "customStreet":{  
      "code":"7800000000000000000000000",
      "street":"Какая-то другая улица"
   },
   "house":"4",
   "building":"",
   "structure":"",
   "flat":""
}

Method address: https://api.dellin.ru/v1/customers/book/addresses/update.xml

<request>
   <appkey>00000000-0000-0000-0000-000000000000</appkey>
   <sessionid>00000000-0000-0000-0000-000000000000</sessionid>
   <counteragentid>1</counteragentid>
   <customStreet>
      <code>7800000000000000000000000</code>
      <street>Какая-то другая улица</street>
   </customStreet>
   <house>4</house>
   <building></building>
   <structure></structure>
   <flat></flat>
</request>
Description of parameters
Request
ParameterR*TypeDescription
appkeyYesstringApplication key. To get the key, register

sessionID

YesstringTo get the session ID, use the User Authorization method

counteragentID

YesstringID of counterparty for which addition of the address is required
customStreetYesobjectInformation about the street
customStreet.codeYesstring

CLADR code of the city.

It's possible to get CLADR code using the services presented on the page "Using CLADR codes"

customStreet.streetYesstringTextual representation of the street
houseYesstringHouse
buildingNostringBuilding
structureNostringStructure
flatNostringApartmetn/office
Notice: You shouldn't use this method of address addition in case of presence of the street code in CLADR directory.

It's also possible to add address on the base of our terminal. In this case all information will be added automatically. Terminal ID is available in the "Terminals" directory.

Request example for this case is presented below:

Request example

Method address: https://api.dellin.ru/v1/customers/book/addresses/update.json

{
   "appkey":"00000000-0000-0000-0000-000000000000",
   "sessionID":"00000000-0000-0000-0000-000000000000",
   "counteragentID":"1",
   "terminal_id":"39"
}

Method address: https://api.dellin.ru/v1/customers/book/addresses/update.xml

<request>
   <appkey>00000000-0000-0000-0000-000000000000</appkey>
   <sessionid>00000000-0000-0000-0000-000000000000</sessionid>
   <counteragentid>1</counteragentid>
   <terminal_id>39</terminal_id>
</request>
Description of parameters
Request
ParameterR*TypeDescription
appkeyYesstringApplication key. To get the key, register

sessionID

YesstringTo get the session ID, use the User Authorization method

counteragentID

YesstringID of counterparty for which addition of the address is required
terminal_idYesstringTerminal ID from the "Terminals" directory

Method response

Response example
{  
   "success":{  
      "addressID":"14"
   }
}
<response>
   <success>
      <addressid>14</addressid>
   </success>
</response>
Description of parameters
Response
ParameterTypeDescription
successobjectInformation about added address
success.addressIDstringID of added address

Error handling

In case of errors, response will contain the names of parameters that caused errors with errors description. Error description in example below: "code doesn't accord to CLADR code".

Response example
{  
   "errors":{  
      "street":"код не соответствует коду КЛАДР"
   }
}
<response>
   <errors>
      <street>код не соответствует коду КЛАДР</street>
   </errors>
</response>

Address editing

In case of editing an address, the request is similar to the request for creating an address, but in this case, it is enough to pass only those address parameters that are need to be edited.

For example, if you want to change only the house number, then it is enough to pass only parameters presented below.

Method request

Request example

Method address: https://api.dellin.ru/v1/customers/book/addresses/update.json

{
   "appkey":"00000000-0000-0000-0000-000000000000",
   "sessionID":"00000000-0000-0000-0000-000000000000",
   "addressID":"1",
   "house":"12"
}

Method address: https://api.dellin.ru/v1/customers/book/addresses/update.xml

<request>
   <appkey>00000000-0000-0000-0000-000000000000</appkey>
   <sessionid>00000000-0000-0000-0000-000000000000</sessionid>
   <addressid>1</addressid>
   <house>12</house>
</request>
Description of parameters
Request
ParameterR*TypeDescription
appkeyYesstringApplication key. To get the key, register

sessionID

YesstringTo get the session ID, use the User Authorization method

addressID

YesstringID of address that needs to be edited
houseYesstringNew house number
Responses of method when adding and editing address are similar.