Skip to content

Instantly share code, notes, and snippets.

@ArturKarbone
Last active October 1, 2022 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ArturKarbone/63d96b8b72908a114c682b9716200a7c to your computer and use it in GitHub Desktop.
Save ArturKarbone/63d96b8b72908a114c682b9716200a7c to your computer and use it in GitHub Desktop.
Warehouse API

Warehouse API

Warehouse API is a nice and sexy service for working with Naburszh Warehouse.

API

API is exposed through the following endpoint –

http://warehouse-api.azurewebsites.net/api

The endpoint is protected by the authentication token. The token must be provided via x-client-id header

Message signing

  • HMAC-SHA1 is used for message signing
  • Hash key will be provided
  • Message consists out of payload (original message) and signature fields

* Creating a new outbound request

POST /outbounds

Example body:

{  
   "payload":{  
      "orderNumber":"5",
      "product":{  
         "name":"Elier",
         "quantity":2,
         "price":41.5
      },
      "receiver":{  
         "firstName":"Test",
         "lastName":"Receiver",
         "phoneNumber":"123456789",
         "houseNumber":"122",
         "addressText":"Some street",
         "addressAdditionalInfo":"apt. 35",
         "country":"LATVIA",
         "zipCode":"1058"
      }
   },
   "signature":"88a4ff5c4288e53b00aee7c15549e3a7c98d9740"
}

Response: 200 OK

{
    "trackingNumber": "01605019895968"
}

Any status except 200 OK should be considered as an error:

Response: 401 Unauthorized - when x-client-id is missing or is wrong

Response: 400 Bad Request - when signature or request data is not valid

Response: 500 Internal Server Error - for internal errors

{
    "error": "<SOME ERROR DESCRIPTION>"
}

* Tracking

POST /tracking/

Example body:

{  
   "payload":{  
      "trackingNumbers":[  
         "01605019895968"
      ]
   },
   "signature":"f4a4a0e3fc2c4a128a3f7441f7596f03d838d039"
}

Response: 200 OK

{
    "statuses": [
        {
            "trackingNumber": "01605019895968",
            "deliveryStatus": "Status in not available. Possible reasons: invalid tracking number or status was not registered yet by DPD",
            "trackingInfo": [
              {
                "dateAndTime": "2017-07-15T08:47:00",
                "place": "DPD data centre",
                "status": "Order information has been transmitted to DPD"                
              }
            ]
        }
    ]
}

Any status except 200 OK should be considered as an error.

Response: 401 Unauthorized - when x-client-id is missing or is wrong

Response: 400 Bad Request - when signature or request data is not valid

Response: 500 Internal Server Error - for internal errors

{
    "error": "<SOME ERROR DESCRIPTION>"
}

For devs

Test Harness

http://localhost:58369/api/testharness/outbound

http://localhost:58369/api/testharness/tracking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment