get-request tagged requests and articles

Categorized request examples and articles tagged with [get-request] keyword
How do I Send a Request with Bearer Token Authorization Header?
To send a request with a Bearer Token authorization header {{using LANG}}, you need to make an HTTP GET or POST request and provide your Bearer Token with the Authorization: Bearer {token} HTTP header. Bearer Authentication (also called token authentication) is an HTTP authentication scheme created as part of OAuth 2.0 but is now used on its own. For security reasons, bearer tokens are only sent over HTTPS (SSL). In this {{LANG}} Bearer Token Authorization Header example, we send a request with a bearer token to the ReqBin echo URL. Click Send to run the {{LANG}} Bearer Token Authorization Header example online and see the results.

How do I send a GET request using Curl?
To make a GET request using Curl, run the curl command followed by the target URL. Curl automatically selects the HTTP GET request method unless you use the -X, --request, or -d command-line option. The target URL is passed as the first command-line option. To add additional HTTP headers, use the -H command line option. Curl automatically adds an Accept: */* request header if no additional headers are passed, which tells the server that the Curl client can accept data in any format. In this Curl GET example, we send a Curl request to the ReqBin echo URL. Click Run to execute the Curl GET Request example online and see the results.

How to get JSON from URL?
To request JSON from an URL {{using LANG}}, you need to send an HTTP GET request to the server and provide the Accept: application/json request header with your request. The Accept header tells the server that our {{LANG}} client is expecting JSON. The server informs the {{LANG}} client that it has returned JSON with a Content-Type: application/json response header. In this {{LANG}} JSON from URL example, we make a GET request to the ReqBin echo URL to get the JSON. Click Send to run {{LANG}} Get JSON from URL example online and see results.

How do I send a GET request?
The GET request method is used to fetch data from the server. A GET request should only fetch data from the server and cannot include data in the GET message body, but you can still send some data to the server in URL parameters. In this {{LANG}} GET request example, we are downloading the content of the ReqBin echo URL. The Accept: */* request header tells the server that the client accepts all media types. The Content-Type: text/html response header informs the client that the server returned HTML for this HTTP GET request. Click Send to run the {{LANG}} GET Request Example online and see the results.

How do I get JSON with Curl?
To get JSON with Curl, you need to make an HTTP GET request and provide the Accept: application/json request header. The 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 in response. If you do not provide an Accept request header, the server may respond with a different MIME type than JSON. The server specifies the returned data type with the Content-Type response header. In this Curl GET JSON example, we send an HTTP GET request to download the JSON from the ReqBin echo URL. Click the Run button to execute the Curl GET JSON example online and see the results.

How do I get JSON from a REST API endpoint?
To get JSON from a REST API endpoint{{ using LANG}}, you must send an HTTP GET request to the REST API server and provide an Accept: application/json request header. The Accept: application/json header tells the REST API server that the API client expects to receive data in JSON format. The Content-Type: application/json response header indicates that the REST API server returned data in JSON format. In this {{LANG}} REST API GET JSON example, we make a GET request to the ReqBin REST API endpoint. Click Send to execute the {{LANG}} REST API GET JSON request online and see the results.

How do I send GET Request with Custom Headers?
To send a GET request with custom HTTP headers, you must provide custom headers in the "Name: Value" format, just like the standard HTTP headers. The format, number, and length of custom headers are unlimited. Custom headers are usually in the X-name form, but this is not required, and you can use your own format when sending custom HTTP headers to the server. In this GET Request with Custom Headers Example, we send a GET request to the ReqBin echo URL with additional data in the custom header. Click Send to execute the GET Request with Custom Headers example online and see the results.

How do I get an XML from the server?
To retrieve XML from the server{{ using LANG}}, you need to send a GET request and specify the "Accept: application/xml" HTTP header in the request. The Accept header tells the server that the client is expecting XML data. Without this header, the server may return data in a different format. The Content-Type: application/xml response header informs the client that the server returned XML. In this {{LANG}} GET XML Example, we send a GET request to the ReqBin echo URL with Accept: application/xml request header. Click Send to execute {{LANG}} GET XML Request example online and see the results.

How do I get XML using Curl?
To retrieve an XML from the server using Curl, you need to pass the target URL to Curl along with the -H "Accept: application/xml" command line option. The -H command line switch sends an Accept: application/xml header to the server and tells the server that the Curl client expects an XML response. Without this header, the server may automatically select a different data type for the response and return the data in a different format than XML. In this Curl GET XML Example, we send a request to the ReqBin echo URL with the required HTTP header. Click Run to execute the Curl GET XML request online and see the result.

How do I send GET request with Basic Server Authentication?
To send a GET request to the server with Basic Authentication credentials, you must pass the "Authorization: Basic {credentials}" HTTP header to the server with the user's credentials encoded in a Base64 string in the login:password format. An Authorization HTTP header must be sent with every request for a protected resource. In this Basic Server Authentication example, we send a GET request to the ReqBin echo URL with user credentials. Click Send to execute GET Request with the Basic Server Authentication credentials online and see the results.

How to send GET request with CORS Headers?
To send a GET request with CORS headers{{ using LANG}}, you need to provide an "Origin: URL" HTTP header that specifies the origin of the request (domain, port, or scheme) other than the destination server address. Before making a GET request with CORS headers, browsers always send an OPTIONS request to check if the target server allows cross-domain requests for the required HTTP method and response headers. The Origin header should only contain the protocol and domain name and not include the URL path. Click Send to execute the {{LANG}} GET request with CORS Example online and see the result on the Response Headers tab.

How do I send a get JSON request?
To get JSON from the server{{ using LANG}}, you must send an HTTP GET request and pass the "Accept: application/json" HTTP header, which will tell the server that the client expects JSON in response. In this {{LANG}} GET JSON example, we send a GET request to the ReqBin echo URL with the "Accept: application/json" request header. Click Send to execute the {{LANG}} GET JSON example online and see the results.

How do I make a GET request with an Accept-Encoding header?
To send a GET request with an Accept-Encoding header, you need to provide an Accept-Encoding header in the "Name: value" format, just like you would for any standard HTTP header. The Accept-Encoding HTTP header indicates that the client can accept data in the specified encoding (for example Accept-Encoding: gzip, deflate, br) and does not indicate the expected data MIME type. To set the acceptable MIME type client sends an Accept header (for example, Accept: text/htm). The Accept-Encoding title is used to speed up the data download from the server since the server can compress the data before sending it to the client in one of the supported encodings. In this GET request with the Accept-Encoding Header example, we send a GET request to the ReqBin echo URL. Click Send to execute the GET Request with the Accept-Encoding Header example online and see the results.

How do I make a GET request without an Accept-Encoding header?
The Accept-Encoding HTTP header indicates that the client can accept data in the specified encoding. The Accept-Encoding header is used to speed up the data download from the server because the server can compress the data before sending it to the client in one of the supported encodings. If you send a GET request without specifying Accept-Encoding header, or if the server does not support the type of compression the client accepts, the response body will not be compressed. In this GET request without the Accept-Encoding Header example, we send a GET request to the ReqBin echo URL. Click Send to execute the GET Request without the Accept-Encoding Header example online and see the results.

NASA Image and Video Library via REST API
Access the NASA Image and Video Library by sending a GET request to the Nasa.gov REST API. Replace {nasa_apikey} with your own Nasa API key.

Astronomy Picture of the Day via REST API
Get the astronomy picture of the day (APOD) by sending a GET request to the Nasa.gov REST API. Replace {nasa_apikey} with your own Nasa API key.

Photo Details and Download Links via REST API
Get complete information of a photo, including size, author name, location, and download links by sending a GET request to the Unsplash.com REST API. Replace {unsplash_apikey} with your own Unsplash Access key.

Search Photos via REST API
Get a page of search results for photos sorted by relevance by sending a GET request to the Unsplash.com REST API. Replace {unsplash_apikey} with your own Unsplash Access key.

Mars Rover Photos via REST API
Get Mars photos gathered by NASA's Curiosity, Opportunity, and Spirit rovers on Mars by sending a GET request to the Nasa.gov REST API. Replace {nasa_apikey} with your own Nasa API key.

List of Popular Photos via REST API
Get a page with a list of photos sorted by popularity by sending a GET request to the Unsplash.com REST API. Replace {unsplash_apikey} with your own Unsplash Access key.

What is HTTP GET Request Method?
The HTTP GET method is one of the most commonly used HTTP methods. It is used to request a resource from the server, cannot have a message body, and must not modify data on the server.

What is HTTP PATCH Request Method?
The PATCH method is one of 9 common request methods supported by the Hypertext Transfer Protocol (HTTP) and used to partially modify an existing resource, as opposed to HTTP PUT, which replaces the entire resource.