Info |
---|
API Documentation |
Info |
---|
Login |
Introduction
For integration purposes there are some APIs that are useful to import data into Plan & Go and also to be able to export.
...
For each session, first get authenticated with /pl/apilogin/v-1/auth/generate
, then use the received token in the header for all the other calls. Like this:
Code Block |
---|
# Example 1) Posting JSON (when logged in, we send the token in the header) curl https://api.planandgo.di.no/plexternal/apiplan/v-1/routePlancreate \ -H "Content-Type:application/json" \ -H "X-APIAuth-Token:olof:5f9a3609a5a295eff861d930a0c75bbee7991842" \ -d "{ \ \"companyId\": 1, \ \"datedistrDate\": '\"2015-12-04T00:00:00.000+0100', \ 04\", \ \"distrNo\": 0, \"name\": \"Utkjoring uke 9\" \ }" |
Environments
- DEV:Â https://dev-planandgo.di.no
- STAGING: https://staging-planandgo.di.no
- PROD: https://planandgo.di.no
API-methods
...
🔓
...
Fetches an login-token that the application can use to gain access to the API.
Get the username/password from DI.
Code Block |
---|
{
"username": "olof",
"password": "secret123"
} |
Code Block |
---|
{
"token": "olof:5f9...842",
"userId": 23432,
"customerSystemId": 233,
"roles: [...]
} |
...
🔒
...
Create an empty route plan (for a given distribution date).
Create a route plan for each area (each plan has a given start-point).
Code Block |
---|
{
companyId: 1,
date: '2015-12-04T00:00:00.000+0100',
name: 'Utkjoring uke 9'
} |
Code Block |
---|
{
id: 344,
date: '2015-12-04T00:00:00.000+0100',
name: 'Utkjoring uke 9',
...
} |
...
Create an empty file (prepare for a file-upload).
Step 1 in file upload.
Code Block |
---|
{
name: 'my-file-name.csv'
} |
Code Block |
---|
{
id: 6722,
name: 'my-file-name.csv',
...
} |
...
Upload the content of the file you have prepared.
Filetypes supported:
- .csv
- .xls
- .xlsx
Mimetype: multipart/form-data
Name the file-field: "file".
See file specification.
Step 2 in file upload.
Code Block |
---|
{
status: 'ok'
} |
...
Fetch the published orders including the routename of each order.
Included for each order is an estimate for WHEN the order will be delivered. It's a time interval like this: HH:MM-HH:MM.
This will return orders across many routePlans, but only from published plans for the given distribution-date.
Assumes that imported customers/deliveries used the ORDER_ID field.
List of orders
Code Block |
---|
[
{
orderId: '12452',
routeName: 'Asker',
timeWindow: '19:29-21:29'
},
{
orderId: '12454',
routeName: 'Asker',
timeWindow: '19:37-21:37'
},
...
{
orderId: '29452',
routeName: 'Skøyen',
timeWindow: '18:11-20:11'
},
...
] |
}"
# Example 2) posting FILE (when logged in, we send the token in the header)
curl https://api.planandgo.di.no/external/plan/v-1/importOrderFile/1234/5678 \
-H "Content-Type: multipart/form-data" \
-H "X-Auth-Token: olof:5f9a3609a5a295eff861d930a0c75bbee7991842" \
-F file=@my_import_file_in_this_dir.csv |
Environment
PROD:
https://api.planandgo.di.no
Parameters you need
companyId
customerSystemId
API-credentials (contact info@di.no to get access)
Most notable controllers
Plan (importing a plan)
Posting a file: Check out the fileformat
Order (extracting orders)
Usage
When the deliveries are ready on your end
(Generate a token for the session)
Repeat these steps for each transport company
Create an empty routeplan, to get a fresh routePlanId (do this for each area that has it's own starting point)
- Create an empty file, to get a fresh fileId
Generate a file (using our file-spec) and post it
. Remember to fill out ORDER_ID (used as key when exporting optimized plans)
- Look for status: 'ok' or handle errors
When the plan is optimized and published
...
(at a agreed time)
(Generate a token for the session)
Fetch the orders and extract the routename, estimater time etc from there (for a given customerSystem and distribution-date)
When the plan has been effectuated / performed
(Generate a token for the session)
Fetch the orders and extract the needed data (info about each order)
When a customer wants to be deleted from your system (GDPR)
Assumes that you have a full history of the customer's orderIds
Generate a token for the session
Call "purgeOrders" given all the customer's orders (for a given customerSystem)