API calls

  Other

URL

Each instance of the CurierManager app may have its own base URL. The generic api url is:

BaseURL/API/<operation>?api_key=<api key>&…

For example if your software instance is http://app.curiermanager.ro/cscourier/ (but it may differ in your case) the full URL to create an expedition will be:

http://app.curiermanager.ro/cscourier/API/create_expedition?api_key=<api_key>&…

The API Key will be created by the courier company. Note: the client using the api key needs to have a working user.

Return Value
All responses are a JSON map, with the following fields:
status can be “done”, “forbidden” or “failed”
message is a text field that usually explains the status
data contains the detailed response.

 The API can be tested using the following address

BaseURL/test_api.html

Create expedition

API/create_awb?api_key=<api key>

The following fields can be added:

“type”, “service_type”, “retur”, “retur_type”, “ramburs”, “ramburs_type”, “insurance”, “weight”, “content”, “comments”, “cnt”,

from_name, from_contact, from_str, from_nr, from_bl, from_sc, from_et, from_ap, from_interfon, from_sector, from_city, from_county, from_zipcode, from_country, from_phone,

to_name, to_contact”, to_str, to_nr, to_bl, to_sc, to_et, to_ap, to_interfon, to_sector, to_city, to_county, to_country, to_zipcode, to_phone, to_extra

type: envelope | package 

service_type: obtain from courier company (eg: regular, express)

retur: 0 | 1  –  Package swap

cnt: number of packages/envelopes

retur_type: colet | document

ramburs: <CoD amount>

ramburs_type: cont | cash  –  CoD type (if sender receives the CoD amount in bank account or as cash

weight: <weight in kg>

insurance: insured value

from_… fields are used for the sender address, to_… fields for the recipient address

…name: name, company name if applicable

…contact: contact within company

str: street

…nr: street number

…bl: building

…sc: entrance

…interfon: interphone number

to_extra: any extra information regarding recipient address

use_default_from_address: if “true”, it will use the default expedition address in the system instead of the fields above.

There are no mandatory fields except api_key, but you should be aware that expeditions lacking relevant information most likely can’t be delivered.

Expeditions with the “cnt” set to values over 1 will be automatically converted to groups. You will receive in the response the number of the first package in the group (like “XXX”), and the rest are created as such:
1st package: XXX
2nd package: XXX/2
3rd package: XXX/3
And so on.

Any number of extra services (like “Delivery Saturday”) can be specified, each by adding a parameter like service_<service id> with the value true. For example if Delivery Saturday has the id 57, you would have: service_57=true

 The full list of available services can be obtained through the API using the URL:

API/list_services?api_key=<api key>

Return value

The data field contains a map with the created expedition. Expedition number is in the “no” field.

The status for the created expedition will be uncollected by default (neridicat for Romanian accounts). It can be changed from the Settings menu (Initial_api_status).

awb_event_handler is an optional parameter which can be used when creating the awb. It contains an URL towards which the system will send event call – POST requests containing a JSON map with the following fields:

  • awb – awb number
  • status – awb status

 Right now the system is sending events for status changes.

Events are being sent asynchronously, with a delay of max 60s.

Get expedition price

API/get_price?api_key=<api key>

Takes the same parameters as API_createAWB, and returns a map with fields “price” and “zone”

Print AWB

API/print?api_key=<apikey>&awbno=<awbno>

Returns the HTML version of the printed waybill.

If you want to save the awb in a pdf format add &pdf=true

You can change the format with the parameter format, with the legal values: a6, default. The default value is approximately a5. 

Get expedition status:

API/get_status?api_key=<apikey>&awbno=<awbno>

Returns a text with the current expedition status.

Change expedition status:

API/change_status?api_key=<apikey>&awbno=<awbno>&status=<newstatus>

Changes the status of the expedition. Can be used to change status from draft to uncollected, from uncollected to active. Can also be used to cancel an expedition, if the permissions to do so are granted.

Get expedition info:

API/get_info?api_key=<apikey>&awbno=<awbno>

Returns a JSON map consisting of:

  • text fields with expedition info (“id”, “no”, “status”, “from_address”, “to_address”, “from_city”, “to_city”, “from_country”, “to_country”, “ramburs”, “ramburs_type”)
  • “invoice”, which contains a map with invoice info (date as unixtime, series, no, value – invoice value without VAT)
  • “decont_client”, which contains a map with client settlement info: date as unixtime, transaction_no, value

Get expedition history:

API/get_history?api_key=<apikey>&awbno=<awbno>


Returns a json map with the fields “no”, “status” and “history”, where history is a list of status changes with the fields:  date (unixtime), status and description

Cancel an expedition:

API/cancel?api_key=<apikey>&awbno=<awbno>

Returns “ok” in case of success, or “forbidden” if the api key client does not have the permission to cancel expeditions.

Get city list

API/list_cities?api_key=<apikey>

Returns a json list of cities, with the fields “name” and “province” for each.

The life-cycle of an expedition

An expedition can have one of the following statuses:

  • draft – it can still be edited by the client. It is not ready for pick-up
  • uncollected – it is ready and waiting for pickup
  • active – being delivered
  • delivered – the expedition has been delivered successfully
  • returned – the expedition has been returned for some reason
  • canceled –  the expedition has been canceled before pickup
  • exception – anything else

Romanian companies will use Romanian language status names. These are: initial, neridicat, in_curs, livrat, returnat, anulat, exceptie.