Back to top

Booking API

This API gives you access to the booking platform. nemLevering.dk is powered by and part of the findaCARGO platform.

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.

  • 404: Not found.

  • 429: Too Many Requests. Rate limited.

  • 500: Internal Server Error.

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.

User Authentication

Login

Login
POST/v1/auth/login/

Callback used when a user logins with email-based authentication.

Example URI

POST http://api.findacargo.com//v1/auth/login/
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "email": "[email protected]",
  "password": "xxxxxxxx"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "name": "Rafael",
  "email": "[email protected]",
  "mobile": "11987346259",
  "buyer": "1",
  "transporter": "1",
  "freight_forwarder": "1",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1NzJiYjYyYmE0MzRiMTVlMGQ5MWFhNjkiLCJuYW1lIjoiUmFmYWVsIiwiaWF0IjoxNDY1ODg5MDU2fQ.OUFPP7Id3Gs5doUso0VPCEXJm-FkK8mSqUjllM_u5KY"
}

Request a Delivery

A delivery can be requested via API.

Request a new delivery

Request a new delivery
POST/v1/deliveries/

Example URI

POST http://api.findacargo.com//v1/deliveries/
Request
HideShow
Headers
Content-Type: application/json
Body
{
        "vehicle_type": "1",
        "cargo_details": {
            "weight": 18.5,
            "size": 4,
        },
        "pickup_location": {
            "description": "",
            "latitude": "",
            "longitude": ""
        },
        "pickup_options": {
            "when": "now",
            "date": "2016-05-12",
            "time": "10:00"
        },
        "dropoff_location": {
            "description": "",
            "latitude": "",
            "longitude": ""
        },
        "dropoff_options": {
            "date": "2016-05-12",
            "time": "11:00"
        },
        "notes": "",
        "promo_code": "",
        "options": ["refrigerated", "extra"]
    }
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "delivery_id": 123,
  "status_id": 2
}

Get details of existing request

Get Details of existing request
GET/deliveries/{delivery_id}

Example URI

GET http://api.findacargo.com//deliveries/delivery_id
URI Parameters
HideShow
delivery_id
integer (required) 

Delivery identificator generated when estimate

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "delivery_id": "5743f8af0e58072b29528946",
  "status": {
    "description": "waiting for carrier acceptance",
    "id": 3
  },
  "created_at": "2016-05-24T06:46:07.335Z",
  "options": [],
  "carriers": [
    {
      "account_id": "5743e7a24e5dacc40eb393bc",
      "status": {
        "description": "carrier notified",
        "id": 1
      },
      "phone": "+551198712345",
      "email": "[email protected]",
      "price": 203.63,
      "vehicle": {
        "vehicle_id": "5743e7b74e5dacc40eb393bd",
        "identifier": "Road 1",
        "type": "1",
        "pickup_distance": 8.8,
        "pickup_time": 25
      }
    }
  ],
  "pickup_location": {
    "description": "Ørestads Boulevard 123",
    "latitude": 55.68843,
    "longitude": 12.44423
  },
  "dropoff_location": {
    "description": "Ørestads Boulevard 2354",
    "latitude": 55.77568,
    "longitude": 12.541413
  },
  "pickup_date": "2016-05-24T06:46:07.334Z"
}

Pay for delivery

Pay for delivery
POST/deliveries/{delivery_id}/pay

Example URI

POST http://api.findacargo.com//deliveries/delivery_id/pay
URI Parameters
HideShow
delivery_id
integer (required) 

Delivery identificator

Request
HideShow
Headers
Content-Type: application/json
Body
{
    "card_encrypted": "adyenjs_0_1_4p1$...",
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "delivery_id": 123,
  "status_id": 4
}

Delivery Status

Get Delivery Status
GET/deliveries/status

Example URI

GET http://api.findacargo.com//deliveries/status
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
    "delivery_id": 123,
    "status": {
        "description": "Canceled"
        "id": 5
}

Get list of carriers and their availability

List of carriers to list depends on carriers ‘online’ status, typically for local deliveries, but also vehicles that may not be online but would be available for scheduled deliveries and vehicles that carry special cargo. This presents a list of vehicles to the UI, even those that aren’t used on local deliveries, allowing any cargo to be booked in the app.

Get list of carriers, vehicles and their availability
GET/v1/carriers/availability/{pickup}/{destination}

Example URI

GET http://api.findacargo.com//v1/carriers/availability/pickup/destination
URI Parameters
HideShow
pickup
string (required) 

Comma separated Latitude and Longitude coordinates

destination
string (optional) 

Comma separated Latitude and Longitude coordinates

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "available_vehicles": [
    {
      "type": {
        "id": 1,
        "description": "Pickup"
      },
      "distance": 22,
      "pickup_time": 35,
      "estimated_cost": 550.6,
      "vehicles": [
        {
          "vehicle_id": "5730fef1883660fd3c61f510",
          "current_location": {
            "lat": -23.68153,
            "long": -46.8754
          },
          "description": "Car 1",
          "distance": "22"
        }
      ]
    }
  ],
  "pickup_location": {
    "description": "2640 Jefferson Court Key West, FL 33040",
    "coordinates": {
      "lat": -23.68153,
      "long": -46.87549
    }
  },
  "dropoff_location": {
    "description": "9857 Lexington Drive Cedar Falls, IA 50613",
    "coordinates": {
      "lat": -24.66853,
      "long": -47.76849
    }
  },
  "delivery_distance": 43,
  "units": {
    "volume": "m3",
    "area": "m2",
    "distance": "km",
    "time": "min",
    "weight": "kg",
    "currency": "kr"
  }
}

Generated by aglio on 30 Jun 2016