EDDYMENS

Published 8 months ago

What Is A Request Body?

A request body is data you send to a service or system to be processed. This can be end-user data or instructions to be interpreted by the system.

When it comes to APIs [→], request data is sent as part of a POST, PATCH, UPDATE, etc. These are requests that receive data to be added, partially or fully updated respectively.

Below is a sample POST CURL request with a request body.

01: curl -X 'POST' \ 02: 'https://petstore3.swagger.io/api/v3/pet' \ 03: -H 'accept: application/json' \ 04: -H 'Content-Type: application/json' \ 05: -d '{ 06: "id": 10, 07: "name": "doggie", 08: "category": { 09: "id": 1, 10: "name": "Dogs" 11: }, 12: "photoUrls": [ 13: "string" 14: ], 15: "tags": [ 16: { 17: "id": 0, 18: "name": "string" 19: } 20: ], 21: "status": "available" 22: }'

Here is another article you might like 😊 What Is A Response Body?