Design and document a restful API to handle the creation of shipping labels. Detail the…
- User
Design and document a restful API to handle the creation of shipping labels. Detail the different endpoints, their function and json structure.
The api should allow the creation of new shipments, the retrieval of status and the download of shipping labels
Assistant
Here is the basic design for the API:
POST /labels - Creates a new shipping label
GET /labels/:id - Retrieves a shipping label by id
DELETE /labels/:id - Deletes a shipping label by id
The body of a POST request to the /labels endpoint should be a JSON object with the following fields:
“recipient”: The recipient of the package, a JSON object with fields “name” and “address”
“sender”: The sender of the package, a JSON object with fields “name” and “address”
“package_type”: The type of package, a string
“tracking_id”: A unique identifier for the package, a string
“service”: The shipping service to use, a string
A successful response from the POST request will be a JSON object with a “label” field containing a base64 encoded label.
A successful response from the GET request will be a JSON object with a “label” field containing a base64 encoded label.
A successful response from the DELETE request will be a JSON object with a “status” field containing “OK”.
- User
Make it more detailed by adding necessary fields to use it with FedEx api
Assistant
Sure, here's a more detailed design for the API that includes fields necessary for using the FedEx API:
POST /labels - Creates a new shipping label
GET /labels/:id - Retrieves a shipping label by id
DELETE /labels/:id - Deletes a shipping label by id
The body of a POST request to the /labels endpoint should be a JSON object with the following fields:
"recipient": The recipient of the package, a JSON object with fields "name", "address", and "phone_number"
"sender": The sender of the package, a JSON object with fields "name", "address", and "phone_number"
"package_type": The type of package, a string
"tracking_id": A unique identifier for the package, a string
"service": The shipping service to use, a string
"weight": The weight of the package, a number
"dimensions": The dimensions of the package, a JSON object with fields "length", "width", and "height"
"package_count": The number of packages in the shipment, a number
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.