Batch Coverage API
Purpose and use of service
The API provides a list of batch coverage files for each product / distribution company pair set up for your company. For each pair, there will be one file per region. Generation of the batch files have to be setup by DI. Contact your CSM for more information.
Setup
| Example | Description |
---|---|---|
Username (see Authentication section) | wsfoobar | A valid username. |
Password (see Authentication section) | a-very-very-long-password | A password matching given username. |
The user is a web service user
The user has access to the owner party of the files
Environments / endpoints
TEST get | https://staging-ws.di.no/ws/json/batchCoverage/v-1/files |
---|---|
PRODUCTION get | https://ws.di.no/ws/json/batchCoverage/v-1/files |
Making a request
Clients using this API should not fail if new optional fields are added to the API. If a new field is added to the request or response on a later stage, existing clients should handle this in a way such as they just ignore the field.
Request header
Field | Value |
---|---|
Content-Type | application/json |
Authorization | $SECRET_WS_TOKEN - jwt token from authentication |
Request query parameter
Field | Description | Example | Data type | Mandatory |
---|---|---|---|---|
ownerPartyId | An optional parameter for specifying which owner party you want files for, in case you have access to several. If not supplied, you will get files from all owner parties you have access to. | 2 | Integer |
|
Curl request example
Response
The endpoint replies with a list of objects in JSON format, containing the following data
Field | Description | Example | Data type |
---|---|---|---|
fileName | The name of the file containing the date it was created, and which product id, distribution company id and region id it is for. | batchcoverage/12/2025-03-11/2-98-122.csv | String |
size | The size of the file in bytes | 119093235 | Number |
regionId | The region id | 122 | Number |
productId | The product id | 2 | Number |
productName | The product name | Parcel B2C | String |
distributionCompanyId | The id of the distribution company | 98 | Number |
distributionCompanyName | The name of the distribution company | Distribution Company 1 | String |
lastModified | When the file was created or last updated | 2025-03-11T07:29:12.000+00:00 | Timestamp |
downloadUrl | An URL where the file can be downloaded. The URL is valid for one hour. | URL |
File structure
The downloadable files will be in the CSV format, with the first row being a header row. The rows themselves contains this data:
Column | Description | Example |
---|---|---|
internalId | A zero-padded internal delivery point id | 000000003443234 |
companyId | The id of the distribution company responsible for the route | 234 |
zipCode | The zip code of the address | 0155 |
postalName | The postal name of address | OSLO |
streetName | The street name of the address | Akersgata |
streetNumber | The street number of the address | 55 |
entrance | The entrance letter of the address | E |
floorNumber | Which floor the delivery is at | 2 |
flatNumber | Which flat number the delivery is at | H0205 |
flatType | A letter denoting the type of flat:
| A |
transportString | A string containing transport related data in this order: | 233-Grenbil1-10-343455-0001 |
sequence | Where on the route this address is placed | 0001 |
mainCar | Number of the transports main car | 233 |
subCar | Identifier of the transports sub car, if any | Grenbil1 |
deliveryPointDescription | A description of the delivery point | Askim Budsentral |
dropCode | The drop code, if any | 10 |
routeNumber | Route number | 343455 |
routeDeliveryType | One letter denoting how the route is handled
| B |
distributionDays | Which days this route covers the address, where 1 is Monday, and 7 is Sunday | 123456 246 135 |
transportDays | Which days the transport for this route runs, where 1 is Monday, and 7 is Sunday | 1234567 |
Example response
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. og search online with the HTTP status code. The HTTP error keys used are based on the standard, and therefore available online (Tips to search “HTTP code XXX”)
In addition to HTTP status there may be more details in the errorKey field. Error Keys can be added at a later stage, clients should handle this as well as an empty value for errorKey
.
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. |
4xx | Client error | Generally receiving an error code that starts with 4 indicates that the client needs to change something. |
500 | Unexpected Server Error | Oops! This may indicates an error on our side. Please try again, if the error continues notify your contact person |
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. New error keys may occur, you should handle this according to the HTTP status code.
Sample error
Field | Description |
---|---|
statusCode | The HTTP code associated with this error. |
errorKey | A machine parseable error code, this may be empty and new errorKeys can be added at a later stage |
errorMap | Additional details pertaining to the error. |