Delivery-api (1.0)

Download OpenAPI specification:Download

This API documentation will help developers in understanding how to communicate with the delivery-api server in order to design user interfaces based on that api signature.

Parcel

Everything about your parcel

Get list of Parcels

Get list of parcel details based on the user role, by default parcels with new status is returned.

query Parameters
status
string
Default: "new"
header Parameters
authorization
string

Access token should be to authorize the use to access protected resource

Responses

Response samples

Content type
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "created_time": "2019-08-24T14:15:22Z",
  • "from_address": "string",
  • "status": "new",
  • "to_address": "string",
  • "pick_up_time": "2019-08-24T14:15:22Z",
  • "deliver_time": "2019-08-24T14:15:22Z"
}

Create Parcel

A user with sender role can only create parcel details

header Parameters
authorization
string

Access token should be to authorize the use to access protected resource

Request Body schema: application/json

From & to addresss should be present

from_address
required
string non-empty
to_address
required
string non-empty

Responses

Request samples

Content type
application/json
{
  • "from_address": "0518 Tennessee Drive",
  • "to_address": "424 Daystar Avenue"
}

Response samples

Content type
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "created_time": "2019-08-24T14:15:22Z",
  • "from_address": "string",
  • "status": "new",
  • "to_address": "string",
  • "pick_up_time": "2019-08-24T14:15:22Z",
  • "deliver_time": "2019-08-24T14:15:22Z"
}

Get Parcel

Get a parcel detail by parcel id, if the user or biker tries to access resource which is not associated with them an is error sent

path Parameters
id
required
string

Parcel id

header Parameters
authorization
string

Access token should be to authorize the use to access protected resource

Responses

Response samples

Content type
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "created_time": "2019-08-24T14:15:22Z",
  • "from_address": "string",
  • "status": "new",
  • "to_address": "string",
  • "pick_up_time": "2019-08-24T14:15:22Z",
  • "deliver_time": "2019-08-24T14:15:22Z"
}

Update Parcel

User with sender role can only update the parcel.

path Parameters
id
required
string

Parcel id

header Parameters
authorization
string

Access token should be to authorize the use to access protected resource

Request Body schema: application/json
from_address
required
string non-empty
to_address
required
string non-empty

Responses

Request samples

Content type
application/json
{
  • "from_address": "0518 Tennessee Drive",
  • "to_address": "424 Daystar Avenue"
}

Response samples

Content type
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "created_time": "2019-08-24T14:15:22Z",
  • "from_address": "string",
  • "status": "new",
  • "to_address": "string",
  • "pick_up_time": "2019-08-24T14:15:22Z",
  • "deliver_time": "2019-08-24T14:15:22Z"
}

Delete Parcel

A user with sender role can only delete parcel which is in the new status.

path Parameters
id
required
string

Parcel id

header Parameters
authorization
string

Access token should be to authorize the use to access protected resource

Responses

Biker - Pickup Parcel

A user with biker role can only pick-up a parcel with status new.

path Parameters
id
required
string

Parcel id

header Parameters
authorization
string

Access token should be to authorize the use to access protected resource

Responses

Response samples

Content type
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "created_time": "2019-08-24T14:15:22Z",
  • "from_address": "string",
  • "status": "new",
  • "to_address": "string",
  • "pick_up_time": "2019-08-24T14:15:22Z",
  • "deliver_time": "2019-08-24T14:15:22Z"
}

Biker - Deliver Parcel

A user with biker role can only deliver parcel which he as pick-up earlier

path Parameters
id
required
string

Parcel id

Responses

Response samples

Content type
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "created_time": "2019-08-24T14:15:22Z",
  • "from_address": "string",
  • "status": "new",
  • "to_address": "string",
  • "pick_up_time": "2019-08-24T14:15:22Z",
  • "deliver_time": "2019-08-24T14:15:22Z"
}

Login

post-login

User can get access & refresh tokens to access protected API's by authenticating using email and password

Request Body schema: application/json

Email and password is required to authentication an user

email
required
string <email> non-empty
password
required
string <password> non-empty

Responses

Request samples

Content type
application/json
{
  • "email": "user@example.com",
  • "password": "pa$$word"
}

Response samples

Content type
{
  • "access_token": "string",
  • "refresh_token": "string"
}