json tagged requests and articles

Categorized request examples and articles tagged with [json] keyword
POST JSON Example
An example of posting a JSON string to the REST API endpoint. In this post JSON example, the Content-Type: application/json request header indicates the media type of the resource in the request body. The Accept: application/json request header tells the server that the client expects JSON. The Content-Type: application/json response header indicates that the server returned JSON.

GET JSON Example
An example of getting JSON from the URL. In this get JSON example, the client sends an Accept: application/json request header to the provided URL to tell the server that it expects JSON. The Content-Type: application/json response header informs the client that the server has returned JSON.

Curl POST JSON Example
An example of a Curl command to post JSON to the API endpoint. To post JSON with Curl, you need to set the content type to application/json. This is done by the -H "Content-Type: application/json" command-line option. The JSON is passed with the curl -d option. Double quotes in JSON are escaped with \".

Curl GET JSON Example
An example of a Curl command to get JSON from the server. The Accept: application/json request header is passed to the server with the curl -H command-line option and tells the server that the client is expecting JSON. The server indicates that it has returned JSON data with a Content-Type: application/json response header.

REST API POST Example
An example of posting JSON to the REST API endpoint. In this REST API POST example, the Content-Type: application/json request header specifies the media type of the resource in the body as JSON. The Accept: application/json request header tells the server that the client expects a JSON string. The Content-Type: application/json response header indicates that the server returned JSON.

REST API GET Example
An example of sending a GET request to the REST API endpoint. In this REST API GET example, the Accept: application/json request header tells the server that the client expects a JSON string. The Content-Type: application/json response header indicates that the server returned JSON for this GET request.

Curl PATCH JSON String
An example of a Curl command for sending a PATCH request with JSON data to the REST API endpoint. In this HTTP PATCH request example, the Content-Type request header indicates the media type of the PATCH request. The JSON data is passed with the Curl -d command-line parameter.

Curl PUT JSON Example
An example of Curl command for updating a resource on the server by sending a PUT request with JSON data to the REST API endpoint. The Content-Type: application/json request header specifies the media type of the resource in the HTTP PUT message body.

PUT JSON Example
An example of sending an HTTP PUT request with JSON data to a REST API endpoint. The Accept: application/json request header tells the server that the client is expecting JSON data. The Content-Type: application/json request header specifies the media type of the resource in the HTTP PUT message body.

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.

JSON Comment Example
An example of including a comment in a JSON. Comments in the form // ... or / * ... * / are not allowed in JSON, but you may have a special element in your JSON, called for example, "_comment", which will contain your comment. The REST API endpoint must ignore this special JSON comment element.

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.

SOAP vs REST
SOAP and REST are known as two of the most common API paradigms. The key difference between SOAP and REST is the way they interact with the server.

REST API
REST API provides an interface for applications to interact with sites by sending and receiving data as JSON (JavaScript Object Notation) objects to the endpoints (URLs) to query, modify and create content on the site.

SOAP API
SOAP is an XML-based messaging protocol specification that strictly defines an entire method of communication between the client and the server.

API Security
The primary purpose of API Security is to comprehend and alleviate the vulnerabilities peculiar to API and its security risks by focusing on strategies and solutions that allow application software and services to integrate and products and services to communicate.