The function api.get_parcelshops_by_address¶
This function return a list of parcelshop according to an address. It needs 3 parameters:
username
: given by IMXpassword
: given by IMXdata
: response data with the parcelshops
Request object¶
Fields List¶
Fields | Description |
---|---|
cf options.network |
|
Dictionary describing the different options. Contains the following fields: | |
Response object¶
Fields List¶
Fields | Description |
---|---|
0 : Poor quality 1 : Medium quality 2 : Excellent quality |
|
List of error data. Contains the following fields : | |
country , options.networks , addressee.postcode , etc. |
|
List of parcelshop data. Contains the following fields : | |
A dictionary object that contains additional information about parcelshop. | |
A dictionary object that contains the information of a parcelshop. | |
A dictionary object that contains the address data of the parcelshop. | |
List of closing periods for the parcelshop. Contains the following fields : | |
List of days and opening hours of the parcelshop. Contains the following fields : | |
Examples¶
Python¶
Example of a query with the python language and the jsonrpclib module:
data = {
"address1": "4 Route de Varigney",
"postcode": "70800",
"town": "Briaucourt",
"country": "FR",
"options" : {
"networks" : "chronopost",
"nb_max" : 2,
"distance_max" : 40,
}
}
server = jsonrpclib.Server("https://webservice.imxpostal.fr/smc/rpc/")
resultat = server.api.get_parcelshops_by_address(USERNAME, PASSWORD, data)
pprint.pprint(resultat)
Returned result :
{
"success": true,
"response_quality": 2,
"nb_relais": 2,
"output": [
{
"distance": 14492,
"details": {
"address": {
"address1": "1 GRANDE RUE",
"address2": null,
"address3": null,
"company": "",
"country": "FR",
"email": "",
"phone": "",
"postcode": "70220",
"province": "",
"town": "FOUGEROLLES"
},
"holidays": [
{
"end": "2017-03-04T00:00:00",
"start": "2017-02-25T00:00:00"
}
],
"latitude": "47.88669680",
"longitude": "6.405361",
"name": "MAISON DE LA PRESSE",
"opening_hours": [
{
"close_afternoon": "19:00",
"close_morning": "12:15",
"open_afternoon": "14:30",
"open_morning": "14:30",
"weekday": "mon"
},
{
"weekday": "tue",
"close_afternoon": "19:00",
"close_morning": "12:15",
"open_afternoon": "14:30",
"open_morning": "14:30",
},
// etc.
],
"options": {
"extra_info": null,
"homepage": "",
"url_google_maps ": "http://maps.google.fr/maps?q=47.88669680,6.405361"
},
"parcelshop_id": "0867S"
},
},
{
"distance": 14416,
"details": {
"address": {
"address1": "20 GRANDE RUE", "address2": "RUE PRINCIPALE EN BAS",
"address3": None, "company": "",
"country": "FR",
"email": "",
"phone": "",
"postcode": "70210",
"province": "",
"town": "VAUVILLERS"
},
"holidays": [],
"latitude": "47.9227777778",
"longitude": "6.098055555560", "name": "PROXI SUPER",
"opening_hours": [
{
"close_afternoon": "", "close_morning": "12:00", "open_afternoon": "", "open_morning": "08:30",
"weekday": "sun"
},
{
"close_afternoon": "19:00",
"close_morning": "12:15",
"open_afternoon": "16:00",
"open_morning": "08:30",
"weekday": "sat"
},
{
"close_afternoon": "19:00",
"close_morning": "12:15",
"open_afternoon": "16:00",
"open_morning": "08:30",
"weekday": "fri"
},
{
"close_afternoon": "19:00",
"close_morning": "12:15",
"open_afternoon": "16:00",
"open_morning": "08:30",
"weekday": "th"
},
{
"close_afternoon": "19:00",
"close_morning": "12:15",
"open_afternoon": "16:00",
"open_morning": "08:30",
"weekday": "wed"
},
{
"close_afternoon": "19:00",
"close_morning": "12:15",
"open_afternoon": "16:00",
"open_morning": "08:30",
"weekday": "tue"
},
{
"close_afternoon": "", "close_morning": "19:00", "open_afternoon": "", "open_morning": "14:30",
"weekday": "mon"
}
],
"options": {
"extra_info": None, "homepage": "", "url_google_maps ":
"http://maps.google.fr/maps?q=47.9227777778,6.098055555560"
},
"parcelshop_id": "5668P"
},
}
],
}
The function api.get_all_parcelshops¶
This function return a list of all parcelshops from the code iso2 country of network selected.
It needs 3 parameters:
username
: given by IMXpassword
: given by IMXdata
: payload required to play with this endpoint
Request data object:¶
Fields | Description |
---|---|
Dictionary describing the different options. Contains the following fields: | |
Response object:¶
Same response as the unfollowing endpoint function api.get_parcelshops_by_address
Examples:¶
Example 1: python with jsonrpclib module¶
Example code with jsonrpclib module
USERNAME = "Your username gived by IMX"
PASSWORD = "Your password gived by IMX"
data = {
"country": "CZ",
"options" : {
"network" : "paketa_relais"
}
}
server = jsonrpclib.Server("https://webservice.imxpostal.fr/smc/rpc/")
resultat = server.api.get_parcelshops_by_address(USERNAME, PASSWORD, data)
pprint.pprint(resultat)
Example 2: python with requests module¶
import requests
from pprint import pprint
USERNAME = "gived by IMX"
PASSWORD = "gived by IMX"
data = {
"id":"XXX",
"jsonrpc":"2.0",
"method":"api.get_all_parcelshops",
"params":[
USERNAME,
PASSWORD,
{
"country": "CZ",
"options" : {
"network" : "paketa_relais"
}
}
]
}
url = "https://webservice.imxpostal.fr/smc/rpc/"
try:
response = requests.post(url, json=data)
except Exception as e:
raise e
else:
result = response["output"]
pprint(result)
api.get_parcelshop_details function¶
This function can be called to get parcelshop information according to its country and ID. This function is not available for the dpdbe_relais network. It requires 3 parameters: • username: given by IMX • password: given by IMX • data: Data dictionary containing your query data
Request object¶
Fields | Description |
---|---|
Version | |
country | |
parcelshop_id | |
language | |
options.network |
Response object¶
Note: same as api.get_parcelshops_by_address but returns a single output rather than a list.
Fields | Description |
---|---|
0 : Poor quality 1 : Medium quality 2 : Excellent quality |
|
List of error data. Contains the following fields : | |
country , options.networks , addressee.postcode , etc. |
|
List of parcelshop data. Contains the following fields : | |
A dictionary object that contains additional information about parcelshop. | |
A dictionary object that contains the information of a parcelshop. | |
A dictionary object that contains the address data of the parcelshop. | |
List of closing periods for the parcelshop. Contains the following fields : | |
List of days and opening hours of the parcelshop. Contains the following fields : | |
Exemples¶
Python¶
Example of a query with the python language and the jsonrpclib module:
Returned result :
{
'success': True 'response_quality': 0,
'nb_relais': 1, 'output': {
'distance': 0 'details': {
'address': {
'address1': '1 GRANDE RUE', 'address2': None, 'address3': None, 'company': '',
'country': 'FR',
'email': '',
'phone': '', 'postcode': '70220', 'province': '',
'town': 'FOUGEROLLES'
},
'holidays': [
{
'end': '2017-03-04T00:00:00', 'start': '2017-02-25T00:00:00'
}
],
'latitude': '47.88669680', 'longitude': '6.405361',
'name': 'MAISON DE LA PRESSE',
'opening_hours': [
{
'close_afternoon': '12:15', 'close_morning': '12:00', 'open_afternoon': '12:00', 'open_morning': '07:00', 'weekday': 'sun'
},
{
'close_afternoon': '17:30', 'close_morning': '12:15', 'open_afternoon': '15:00', 'open_morning': '07:00', 'weekday': 'sat'
},
{
'close_afternoon': '19:00', 'close_morning': '12:15', 'open_afternoon': '14:30', 'open_morning': '06:30', 'weekday': 'fri'
},
{
'close_afternoon': '19:00', 'close_morning': '12:15', 'open_afternoon': '14:30', 'open_morning': '06:30', 'weekday': 'th'
},
{
'close_afternoon': '19:00', 'close_morning': '12:15', 'open_afternoon': '14:30', 'open_morning': '06:30', 'weekday': 'wed'
},
{
'close_afternoon': '19:00', 'close_morning': '12:15', 'open_afternoon': '14:30', 'open_morning': '06:30', 'weekday': 'tue'
},
{
'close_afternoon': '12:15', 'close_morning': '12:00', 'open_afternoon': '12:00', 'open_morning': '06:30', 'weekday': 'mon'
}
],
'options': {
'extra_info': None, 'homepage': '',
'url_google_maps ': 'http://maps.google.fr/maps?q=47.88669680,6.405361'
},
'parcelshop_id': '0867S'
},
},
}
Contact & support¶
For any technical question regarding setup and API use, please contact us by email at : ws.dev@imxpostal.fr.