How do I get JSON from a REST API endpoint?

To receive JSON from a REST API endpoint, you must send an HTTP GET request to the REST API server and provide an Accept: application/json request header. The Accept header tells the REST API server that the API client expects JSON. In this REST API GET example, we are making a GET request to the ReqBin echo REST API endpoint. The Content-Type: application/json response header indicates that the REST API server returned JSON.
Loading...