Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

List events from the event log.

This document is laid out as follows

...

Access to API

...

Example

...

Username (see Authentication section)

...

wsfoobar

...

Password (see Authentication section)

...

a-very-very-long-password

...

Notes

...

The purpose of the API is to return last or all events registered for a parcel

Content

Table of Contents
maxLevel3


Setup

Example

Username (see Authentication section)

wsfoobar

Password (see Authentication section)

a-very-very-long-password


Environments / endpoints

TEST

Status
colourBlue
titleGET

Code Block
https://staging-ws.di.no/ws/json/parcel/tracking/v-1/fetch/{identifier}/{locale}/{onlyLastEvent}

PRODUCTION

Status
colourBlue
titleGET

Code Block
https://ws.di.no/ws/json/parcel/tracking/v-1/fetch/{identifier}/{locale}/{onlyLastEvent}

Authentication

This endpoint requires the user to be authenticated. Refer to the documentation here for more information on how to obtain a valid token to use in your request. 

Making a request

Info

Notes

  • Clients using this API should not fail if new fields are added to the response. If a new field is added to the response on a later stage, existing clients should handle this in a way such as they just ignore the field.

  • Fields not set in the response are not left out, that is fields in the response may have null values. E.g. "shipmentNumber": null. The client using the endpoint should handle this.  

  • For shipments older than 6 months no events will be available, only latest status

...

TEST

...

Status
colourBlue
titleGET

...

Code Block
https://staging-ws.di.no/ws/json/parcel/tracking/v-1/fetch/{identifier}/{locale}/{onlyLastEvent}

...

PRODUCTION

...

Status
colourBlue
titleGET

...

Request header

key

value example

comment

Authorization

Code Block
Bearer $SECRET_WS_TOKEN

see Parcel Event Log v1#Authentication

Content-Type

application/json


Path parameters

parameter

example

description

identifier

370724760010119754

Shipment or item identifier

locale

NO

Language code. eventDescription will be translated to locale. Supported languagecodes are currently:

  • NO - Norwegian

  • EN - English

onlyLastEvent

false

If set to true only the last registered event is returned. Last registered is decided based on eventTime. If false, all available events are returned 

Curl request example
Code Block
curl --request GET --url https://staging-ws.di.no/ws/json/parcel/tracking/v-1/fetch/

...

key

...

value example

...

comment

...

Authorization

...

370724760120000898/NO/false  \
     --header "Authorization: Bearer $SECRET_WS_TOKEN

...

see Parcel Event Log v1#Authentication

"  \
     --header 'Content-Type

...

: application/json' \

...

Response

...

Name

...

Type

...

Description

parameter

events

example

description

identifier

370724760010119754

Shipment or item identifier

locale

NO

Language code. eventDescription will be translated to locale. Supported languagecodes are currently:

  • NO - Norwegian

  • EN - English

onlyLastEvent

false

If set to true only the last registered event is returned. Last registered is decided based on eventTime. If false, all available events are returned 

...

The endpoint require authentication, as described here: LoginV2

...

Name

...

Type

...

Description

...

events

...

list of events

...

List of events

...

Name

Type

Example

Max Length

Description

shipmentNumber

string

(401)70712190172720651

35

Globally unique identifier for the shipment. Typically a GINC code.

trackingReference

string

(00)370724760010119754

35

Tracking reference for the item, typically a SSCC gs1 code.

eventTime

string

2017-08-22 13:55:13

19

Time of the event registered in originating system. Datetime format yyyy-MM-dd HH:mm:ss

lat

double

59.911096

9

Latitude for the location of the event

lon

double

10.752457

9

Longitude for the location of the event

locationContext

string

Osloveien 14, 0288 Oslo

255

Address or description of the location/ context of the event

locationContextId

string

34567

10

Unique identification of the locationContext

Parcel Event Log v1#eventType

eventType

eventType object

n/a

Description of the event, will be translated to defined locale

Parcel Event Log v1#additionalInfo

additionalInfo

additionalInfo object

n/a

Additional

list of events

List of events


Events

Name

Type

Example

Max Length

Description

shipmentNumber

string

(401)70712190172720651

35

Globally unique identifier for the shipment. Typically a GINC code.

trackingReference

string

(00)370724760010119754

35

Tracking reference for the item, typically a SSCC gs1 code.

eventTime

string

2017-08-22 13:55:13

19

Time of the event registered in originating system. Datetime format yyyy-MM-dd HH:mm:ss

lat

double

59.911096

9

Latitude for the location of the event

lon

double

10.752457

9

Longitude for the location of the event

locationContext

string

Osloveien 14, 0288 Oslo

255

Address or description of the location/ context of the event

locationContextId

string

34567

10

Unique identification of the locationContext

Parcel Event Log v1#eventType

eventType

eventType object

n/a

Description of the event, will be translated to defined locale

Parcel Event Log v1#additionalInfo

additionalInfo

additionalInfo object

n/a

Additional description of the event, will be translated to defined locale

Parcel Event Log v1#eventGroup

eventGroup

eventGroup object

n/a

Groupage of event, e.g. transportation events, communication events etc.

communicationChannel

string

SMS

n/a

Communication channel only used for event types within event group "communication".

ComChannelTypes  in use:

  • SMS

  • EMAIL

changeUserId

whole number

112233

n/a

Internal user identification responsible for the event taking place. Only returned for callees having the highest access level

Parcel Event Log v1#regSystem

regSystem

regSystem object

n/a

System that registered the event

message

string


255

Optional message from the system registering the event


eventType

Name

Type

Example

Max length

Description

apiKey

string

001

n/a

Identifier for the event group

description

string

Package received

n/a

Static description of the event, will be translated to defined locale

Parcel Event Log v1#eventGroup

eventGroup

eventGroup objecti18nKey

string

event.type.pub.shipment.received

n/a

Groupage of event, e.g. transportation events, communication events etc.

communicationChannel

string

SMS

Key which can be used to add your own translations

additionalInfo

Name

Type

Example

Max length

Description

apiKey

string

001

n/a

Communication channel only used for event types within event group "communication".

ComChannelTypes  in use:

  • SMS

  • EMAIL

changeUserId

whole number

112233

n/a

Internal user identification responsible for the event taking place. Only returned for callees having the highest access level

Parcel Event Log v1#regSystem

regSystem

regSystem object

n/a

System that registered the event

message

string

255

Optional message from the system registering the event

...

Name

...

Type

...

Example

...

Max length

...

Description

...

apiKey

...

string

...

001

...

n/a

...

Identifier for the event group

...

description

...

string

...

Package received

...

n/a

...

Static description of the event, will be translated to defined locale

...

i18nKey

...

string

...

event.type.pub.shipment.received

...

n/a

...

Key which can be used to add your own translations

...

Name

...

Type

...

Example

...

Max length

...

Description

...

apiKey

...

string

...

001

...

n/a

...

Identifier for the additional info group

...

description

...

string

...

Package received

...

n/a

...

Static description of the event, will be translated to defined locale. Can be concatenated with the Parcel Event Log v1#eventType description for a more detailed description. The formatting is already taken care of

...

i18nKey

...

string

...

event.type.pub.shipment.received

...

n/a

...

Key which can be used to add your own translations

...

Name

...

Type

...

Example

...

Max length

...

Description

...

id

...

whole number

...

1

...

n/a

...

identifier for the event group

...

name

...

string

...

communcation

...

n/a

...

named classification of the group

...

Group id

...

Description

...

1

...

Information on shipments received/imported in DI

...

2

...

Information on transportation

...

3

...

Information on communication

...

4

...

Information on status updates

...

5

...

Information on scanning of shipments

...

6

...

Information for shipments transported by others

...

7

...

Information from/relating to external systems

...

8

...

Information on internal processing

...

Name

...

Type

...

Example

...

Max length

...

Description

...

id

...

whole number

...

1

...

n/a

...

identifier for the originating system

...

name

...

string

...

Postnord

...

n/a

...

named classification of the originating system

...

Curl request
Code Block
languagebash
curl --request GET --url https://staging-ws.di.no/ws/json/parcel/tracking/v-1/fetch/370724760120000898/NO/false  \
     --header "Authorization: Bearer $SECRET_WS_TOKEN"  \
     --header 'Content-Type: application/json' \
Response

...

languagexml

...

Identifier for the additional info group

description

string

Package received

n/a

Static description of the event, will be translated to defined locale. Can be concatenated with the Parcel Event Log v1#eventType description for a more detailed description. The formatting is already taken care of

i18nKey

string

event.type.pub.shipment.received

n/a

Key which can be used to add your own translations

eventGroup

Name

Type

Example

Max length

Description

id

whole number

1

n/a

identifier for the event group

name

string

communcation

n/a

named classification of the group

Group id

Description

1

Information on shipments received/imported in DI

2

Information on transportation

3

Information on communication

4

Information on status updates

5

Information on scanning of shipments

6

Information for shipments transported by others

7

Information from/relating to external systems

8

Information on internal processing

regSystem

Name

Type

Example

Max length

Description

id

whole number

1

n/a

identifier for the originating system

name

string

Postnord

n/a

named classification of the originating system

List of possible events

Response from Pacel Event Log API  (no/en).pdf

Examples

Expand
titleExample response
Code Block
{
    "events": [
        {
            "shipmentNumber": "70724760120000880",
            "trackingNumber": "370724760120000898",
            "eventTime": "2017-11-09 07:00:39",
            "lat": null,
            "lon": null,
            "locationContext": null,
            "eventType": {
                "apiKey": "011",
        
{
        "description": "Pakke levert sendt til 
"shipmentNumber
mottaker"
:

"70724760120000880",
            },
			"
trackingNumber
additionalInfo": 
"370724760120000898"
null,
            "
eventTime
eventGroup": 
"2017-11-09 07:00:39",
{
                "
lat
id": 
null
3,
                "
lon
name": 
null,
"Communication"
            
"locationContext": null
},
            "
eventType
comChannelType": 
{
"SMS",
            
"
apiKey
changeUserId": 
"011",
null,
            
"
description
regSystem": 
"Pakke
null,
levert
 
sendt til mottaker"
           
}, "additionalInfo
"message": null
,

        },
   
"eventGroup":
 
{
    {
            "
id
shipmentNumber": 
3,
"70724760120000880",
            "
name
trackingNumber": "
Communication
370724760120000898",
            "eventTime": 
}
"2017-11-09 04:13:23",
            "
comChannelType
lat": 
"SMS"
null,
            "
changeUserId
lon": null,
            "
regSystem
locationContext": 
null
"OSLO",
            "
message
eventType": {
  
null
         
},
     "apiKey": "013",
   
{
             "
shipmentNumber
description": "
70724760120000880",
Pakken er levert til mottaker"
            
"trackingNumber": "370724760120000898"
},
            "
eventTime
additionalInfo": 
"2017-11-09 04:13:23",
null,
			"eventGroup": {
                "
lat
id": 
null
4,
                "
lon
name": 
null,
"Status"
            
"locationContext": "OSLO"
},
            "
eventType
comChannelType": 
{
null,
            "changeUserId": null,
  
"apiKey":
 
"013",
         "regSystem": null,
       
"description":
 
"Pakken
 
er
 
levert
 
til
 
mottaker
"message": null
        
},
		{
            "
additionalInfo
shipmentNumber":
null,
 
"
eventGroup": {
70724760120000880",
            "
id
trackingNumber": 
4
"370724760120000898",
            
"name
"eventTime": "
Status" }
2017-11-08 23:00:39",
            "
comChannelType
lat": null,
            "
changeUserId
lon": null,
            "
regSystem
locationContext": 
null
"OSLO",
            "
message
eventType": 
null
{
     
},
 
{
          
"
shipmentNumber
apiKey": "
70724760120000880
057",
                "
trackingNumber
description": "
370724760120000898",
Pakken er ikke levert"
          
"eventTime":
 
"2017-11-08 23:00:39"
 },
            "
lat
additionalInfo":
null,
 {
                "
lon
apiKey": 
null,
"001",
                "
locationContext
description": "
OSLO",
. Finner ikke mottakers leveringspunkt"
            },
            "
eventType
eventGroup": {
                "
apiKey
id": 
"057"
4,
                "
description
name": "
Pakken er ikke levert
event.type.group.status"
            },
            "
additionalInfo
comChannelType": 
{
null,
            
"
apiKey
changeUserId": 
"001"
null,
            
"
description
regSystem": {
".
 
Finner
 
ikke
 
mottakers
 
leveringspunkt"
            "id": 
}
2,
            
"eventGroup":
 
{
   "name": "eBudbok"
            
"id": 4,
},
            
"
name
message": 
"event.type.group.status"
null
        
},
        {
            "
comChannelType
shipmentNumber": 
null
"70724760120000880",
            "
changeUserId
trackingNumber": 
null
"370724760120000898",
            "
regSystem
eventTime": 
{
"2017-11-08 15:00:39",
            
"
id
lat": 
2
null,

            "
name
lon": 
"eBudbok"
null,
            
},
"locationContext": "Nettbutikk AS",
            "
message
eventType": {
  
null
         
},
     "apiKey": "001",
  
{
              "
shipmentNumber
description": "
70724760120000880",
Informasjon om forsendelsen er mottatt"
            
"trackingNumber
},
			"additionalInfo": 
"370724760120000898"
null,
            "
eventTime
eventGroup":
"2017-11-08 15:00:39",
 {
                "
lat
id": 
null
1,
                "
lon
name": 
null,
"Import"
            
"locationContext": "Nettbutikk AS"
},
            "
eventType
comChannelType": 
{
null,
            "
apiKey
changeUserId": 
"001"
null,
            "regSystem": null,
  
"description": "Informasjon om forsendelsen er mottatt"
          "message": null
        }
    
}, "additionalInfo": null, "eventGroup": { "id": 1, "name": "Import" }, "comChannelType": null, "changeUserId": null, "regSystem": null, "message": null } ] }

...

]
}


Error handling

API requests that result in errors will return an appropriate HTTP status code to help you identify the type of error. You can use the table below to understand what each code means.

HTTP Status code

Text

Description

400

Client or Validation Error

The request body/query string is not in the correct format.

401

Authentication Failure

Indicates that the Authorization header is either missing or incorrect. You can learn more about the Authorization header here.

403

Access denied

This indicates that the agent whose credentials were used in making this request was not authorized to perform this API call. It could be that you do not have access to the shop or transportsolution you provided in your request. If you believe this is a mistake, please reach out to your contact so it can be rectified.

405

Method not allowed

This API request used the wrong HTTP verb/method. For example a PUT request will result in this error.

500

Unexpected Server Error

Oops! This indicates an error on our side, and there is nothing more you can do. Please [email|mailto:support@di.no] us a description of your problem and we will see what we can do.

Error response

In addition to the HTTP status code, most errors will also return a response body that contains more information to help you debug the error. A sample error response is shown below. The format of the error response body is explained after the example.

Sample error

Code Block
{
    "statusCode": 401,
    "errorKey": "authentication.missing",
    "errorMap": {}
}

Field

Description

statusCode

The HTTP code associated with this error.

errorKey

A machine parseable error code.

errorMap

Additional details pertaining to the error.