Back to top

Scheduled Deliveries API

This API is used for managing Scheduled Deliveries.

Getting Started

Our API is…

  • REST based

  • Standard HTTP verbs like GET, POST, PUT…

  • Standard HTTP error responses to describe errors

  • Authentication and authorization are based on the OAuth 2.0 standard

  • Requests use standard encoding

  • All communication done over SSL (https://)

  • POST data should be encoded as standard application/x-www-form-urlencoded

  • Responses on JSON format

##Available servers:

Return Codes & Error Handling

Errors are identified with their HTTP status codes and response includes a JSON body with complementary information.

  • 200: OK. Everything worked as expected.

  • 201: Created. We will return a 201 after a successful POST where a resource was created.

  • 400: Malformed request.

  • 401: Unauthorized the request requires user authentication (not logged in)

  • 403: Forbidden. Also used for unauthorized requests such as improper OAuth 2.0 scopes or permissions issues.

Data on JSON body includes:

  • message: Return in an human-readable format.

  • code: Underscored delimited string.

  • fields (optional): Array that provide extra detail about the specific return.

Validating data fields

  • Addresses: Please note that delivery requests are not accepted without automatically validated addresses. We recommend doing client-side validation of those addresses before calling this API. Zip, city and address_1 fields are used for address validation ; address_2 is optional and should include data that cannot be automatically validated (eg: “d�r 1”, “7tv”, etc…).

Scheduled Deliveries

Settings v1

Settings v1
GET/v1/settings/config

Setting variables related to scheduled deliveries

Example URI

GET https://api.nemlevering.dk/v1/settings/config
Request
HideShow
Headers
Token: "Api token generated for you by nemlevering"
Response  200
HideShow
Headers
Token: "Api token generated for you by nemlevering"
Content-Type: application/json
Body
{
  "week_days_available": [
    "Thursday"
  ],
  "delivery_windows": [],
  "store_pickup": true,
  "pickup_deadline": "02:05",
  "home_delivery": true,
  "delivery_window_start": "04:20",
  "delivery_window_end": "04:20",
  "allow_to_send_email": true,
  "allow_to_send_SMS": true,
  "address": "Gurugram, Haryana, India",
  "allowed_pickup_areas": [
    {
      "zip_to": "9999",
      "zip_from": "0"
    }
  ],
  "allowed_delivery_areas": [
    {
      "zip_to": "9999",
      "zip_from": "0"
    }
  ]
}
Response  400
HideShow
Headers
Token: "Api token generated for you by nemlevering"
Content-Type: application/json
Body
{
  "message": "User not found.",
  "error": {
    "status": 400
  }
}

Create Scheduled delivery v1.3

Creates a new delivery/deliveries. Insurance fields are supported and dropshipping settings are checked

Create request v1.3
POST/v1.3/scheduled/create

Creates new scheduled deliveries based on array of received objects.

Example URI

POST https://api.nemlevering.dk/v1.3/scheduled/create
Request
HideShow
Headers
Content-Type: application/json
Token: "Api token generated for you by nemlevering"
Body
[
  {
    "delivery_id": "Test",
    "cargo_insurance": {
      "enabled": true,
      "value": 123
    },
    "recipient_id": "",
    "recipient_name": "Test user",
    "recipient_phone": {
      "country_iso_code": "DK",
      "country_dial_code": "45",
      "phone": "123"
    },
    "recipient_email": "",
    "delivery_date": "2018-04-04T21:00:00.000Z",
    "pickup_window": {
      "from": "02:10",
      "to": "03:15"
    },
    "delivery_location": {
      "description": "",
      "zip": "2100",
      "city": "K�benhavn",
      "address_1": "Kattegatvej 57",
      "address_2": ""
    },
    "delivery_window": {
      "from": "08:00",
      "to": "16:00"
    },
    "delivery_label": "",
    "delivery_notes": "",
    "delivery_number_of_packages": "1",
    "pickup_location": {
      "description": "",
      "zip": "2100",
      "city": "K�benhavn",
      "address_1": "Kattegatvej 53",
      "address_2": ""
    }
  }
]
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "department": "Catering",
  "delivery_status": 1,
  "scheduled_id": "5aba00dcafe9af1843c294b7",
  "packages": 2,
  "notes": "",
  "order": -1,
  "labels_url": "https://labels.nemlevering.dk/5aba00dcafe9af1843c294b7",
  "track_url": "https://track.nemlevering.dk/5aba00dcafe9af1843c294b7",
  "estimated_delivery_time": "08:00 - 16:00",
  "pickup_deadline": "16:30",
  "pickup_deadline_to": "17:00",
  "pickup_location": {
    "info": "",
    "description": "Kattegatvej 53, 2100 K�benhavn, Denmark",
    "latitude": 55.722582,
    "longitude": 12.6082901
  },
  "dropoff_location": {
    "info": "",
    "description": "Kattegatvej 57, 2100 K�benhavn, Denmark",
    "latitude": 55.722534,
    "longitude": 12.607489
  },
  "pickup_date": "2018-04-05T00:00:00",
  "buyer": {
    "name": "Roma",
    "phone": "45 123",
    "email": ""
  },
  "carrier_status": {
    "carrier_status": 0,
    "description": "Not Started"
  }
}
Response  400
HideShow
Body
{
  "message": "Pickup zone doesn't fall into allowed range. Zip code: 2100.",
  "error": {
    "status": 400
  }
}
Response  400
HideShow
Body
{
  "message": "Delivery zone doesn't fall into allowed range. Zip code: 2100.",
  "error": {
    "status": 400
  }
}

Update Scheduled delivery v1.3

Updates existing delivery/deliveries. Insurance fields are supported and dropshipping settings are checked

Update request v1.3
POST/v1.3/scheduled/update

Updates existing scheduled deliveries based on array of received objects.

Example URI

POST https://api.nemlevering.dk/v1.3/scheduled/update
Request
HideShow
Headers
Content-Type: application/json
Token: "Api token generated for you by nemlevering"
Body
[
  {
    "scheduled_id": "5ab3b4cb038cbe9805c957b1",
    "delivery_id": "Test",
    "cargo_insurance": {
      "enabled": true,
      "value": 123
    },
    "recipient_id": "",
    "recipient_name": "Test user",
    "recipient_phone": {
      "country_iso_code": "DK",
      "country_dial_code": "45",
      "phone": "123"
    },
    "recipient_email": "",
    "delivery_date": "2018-04-04T21:00:00.000Z",
    "pickup_window": {
      "from": "02:10",
      "to": "03:15"
    },
    "delivery_location": {
      "description": "",
      "zip": "2100",
      "city": "K�benhavn",
      "address_1": "Kattegatvej 57",
      "address_2": ""
    },
    "delivery_window": {
      "from": "08:00",
      "to": "16:00"
    },
    "delivery_label": "",
    "delivery_notes": "",
    "delivery_number_of_packages": "1",
    "pickup_location": {
      "description": "",
      "zip": "2100",
      "city": "K�benhavn",
      "address_1": "Kattegatvej 53",
      "address_2": ""
    }
  }
]
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "department": "Catering",
    "delivery_status": 1,
    "scheduled_id": "5ab3b4cb038cbe9805c957b1",
    "packages": 1,
    "notes": "",
    "order": -1,
    "labels_url": "https://labels.nemlevering.dk/5ab3b4cb038cbe9805c957b1",
    "track_url": "https://track.nemlevering.dk/5ab3b4cb038cbe9805c957b1",
    "estimated_delivery_time": "08:00 - 16:00",
    "pickup_deadline": "16:30",
    "pickup_deadline_to": "17:00",
    "pickup_location": {
      "info": "",
      "description": "Kattegatvej 53, 2100 K�benhavn, Denmark",
      "latitude": 55.722582,
      "longitude": 12.6082901
    },
    "dropoff_location": {
      "info": "",
      "description": "Kattegatvej 57, 2100 K�benhavn, Denmark",
      "latitude": 55.722534,
      "longitude": 12.607489
    },
    "pickup_date": "2018-04-10T00:00:00",
    "buyer": {
      "name": "Roma",
      "phone": "45 123",
      "email": ""
    },
    "carrier_status": {
      "carrier_status": 0,
      "description": "Not Started"
    }
  }
]
Response  400
HideShow
Body
{
  "message": "Pickup zone doesn't fall into allowed range. Zip code: 2100.",
  "error": {
    "status": 400
  }
}
Response  400
HideShow
Body
{
  "message": "Delivery zone doesn't fall into allowed range. Zip code: 2100.",
  "error": {
    "status": 400
  }
}
Response  400
HideShow
Body
{
  "message": "Planned or finished deliveris cannot be updated. Delivery ID: 5ab3b4cb038cbe9805c957b1.",
  "error": {
    "status": 400
  }
}

Delete Scheduled delivery v1

Deletes existing delivery

Delete request v1
DELETE/v1/scheduled/

Deletes existing scheduled delivery based on received identifier

Example URI

DELETE https://api.nemlevering.dk/v1/scheduled/
Request
HideShow

Delivery exists and can be deleted.

Headers
Token: "Api token generated for you by nemlevering"
Response  200
Response  400
HideShow
Body
{
  "message": "Planned or finished deliveris cannot be deleted. Delivery ID: 5ab3b4cb038cbe9805c957b1.",
  "error": {
    "status": 400
  }
}

Generated by aglio on 28 Mar 2018