post-json tagged requests and articles

Categorized request examples and articles tagged with [post-json] keyword
How do I post JSON to the server?
To post JSON data to the server, you need to use the HTTP POST method and set the correct MIME type for the request body. The correct MIME type for JSON is application/json. In this POST JSON example, the Content-Type: application/json request header specifies the media type for the resource in the body, and the Accept: application/json header tells the server that the client is expecting JSON.

How do I POST JSON with Curl?
To post JSON data using Curl, you need to set the Content-Type of your request to application/json. This is done using the -H "Content-Type: application/json" command line parameter. JSON data is passed with the curl -d command line option. Double quotes in JSON are escaped with \". Click Run to execute Curl POST JSON example online and see results.

How do I post JSON to a REST API endpoint?
To post JSON to a REST API endpoint, you must send an HTTP POST (PUT or PATCH) request to the REST API server and provide JSON data in the body of the POST message. You also need to specify the data type in the body of the POST message using the Content-Type: application/json request header. In this REST API POST example, we also send the Accept: application/json request header to tell the REST API server that the API client expects JSON.

POST JSON String With Basic Authentication
An example of posting JSON string with basic auth credentials. The user authentication credentials are automatically converted to the Base64 encoded string and passed to the server with Authorization: Basic bG9naW46cGFzc3dvcmQ= request header.

REST API Example
An example of sending JSON data to the REST API endpoint. The Accept: application/json request header indicates that the client wants to receive data in JSON format. The Content-Type: application/json response header informs the client that the server has returned JSON.

POST JSON With Bearer Token Authorization Header
An example of posting a JSON string with Bearer Token Authorization Header. The Bearer Token is sent to the server with the Authorization: Bearer {token} request header. The Accept: application/json header tells the server that the client expects a JSON string in response.