Skip to content

Latest commit

 

History

History
99 lines (67 loc) · 2.55 KB

USE_CASES.md

File metadata and controls

99 lines (67 loc) · 2.55 KB

Dispatch with the lowest cost

It is the process that calculates the dispatch with the lowest available cost.

POST {{dns}}/dispatches

Request

Parameter Type Description Constraints Required
person Object Recipient's data. Yes
person.name String Recipient's name. Maximum of 255 characters. Yes
person.distance Float Recipient's distance. Positive value, between 0.1 and 20000.00. Yes
product Object Product's data. Yes
product.name String Product's name. Maximum of 255 characters. Yes
product.weight Float Product's weight. Positive value, between 0.1 and 1000.00. Yes
{
    "person": {
        "name": "Gustavo",
        "distance": 800.0
    },
    "product": {
        "name": "MacBook Pro",
        "weight": 2.16
    }
}

Responses

  • 204 No Content

    Description: Indicates that based on the request data, a dispatch with the lowest cost has been calculated.

    Content-Type: application/json

    Body: N/A

  • 400 Bad Request

    Description: Indicates that the request could not be processed due to client issues.

    Content-Type: application/json

    Body:

    {
        "error": "There are no carriers available for dispatch."
    } 
  • 404 Not Found

    Description: Indicates that the requested resource could not be found.

    Content-Type: application/json

    Body:

    {
        "error": "There are no carriers available for dispatch."
    }
  • 422 Unprocessable Entity

    Description: Indicates that one or more of the provided values are invalid.

    Content-Type: application/json

    Body:

    {
        "error": "Weight is out of range. Current <2000.16>, Maximum <1000.00>."
    }
  • 500 Internal Server Error

    Description: Indicates that an unexpected error occurred on the server while processing the request.

    Content-Type: application/json

    Body:

    {
        "error": "An internal server error occurred."
    }