rest-api tagged requests and articles

Categorized request examples and articles tagged with [rest-api] 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 \".

IP Address Details via REST API
This page shows how to get details for the selected IP addresses by sending a GET request to the IPInfo.io REST API. Replace {ipinfo_apikey} bearer token with your own API token.

Current Weather Data for the Selected City via REST API
This page shows how to get the current weather data for the selected city by sending a REST API request to the OpenWeather API endpoint. The weather REST API key is passed in the "openweathermap_apikey" URL parameter. The city name is passed in the 'q' URL parameter. The weather REST API supports HTTP GET requests.

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.

Latest Foreign Exchange Rates via REST API
This page shows how to get the latest foreign exchange rates (forex) by sending a GET request to the Fixer.io REST API. Replace {fixer_apikey} with your own Fixer API key.

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.

Convert Curl to HTTP Request
Convert Curl command to the HTTP request. Enter your Curl request, click Send to check if you entered it correctly, and then click the Raw tab to see the HTTP request. You can also convert Curl request to PHP, Python, JavaScript, and C# code.

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.

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.

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.

Curl DELETE Request Example
An example of sending a DELETE request with Curl. In this Curl delete request example, the -X command-line option indicates the DELETE method, and the -H command-line option passes and custom HTTP header to the server.

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.

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.

Geocode Address via REST API
Get the associated latitude and longitude for an address by sending a POST request to the Mapquest.com REST API. Replace {mapquest_apikey} with your own Mapquest API key.

Convert Latitude and Longitude to Address via REST API
Convert latitude and longitude to a location (reverse geocode) by sending a POST request to the Mapquest.com REST API. Replace {mapquest_apikey} with your own Mapquest API key.

Foreign Exchange Reference Rates REST API Example
This page shows how to get the foreign exchange reference rates from exchangeratesapi.io service. Rates are quoted against the USD base currency. No API key is required.

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.

Weather REST API Example
An example of getting the current weather data for a selected city via the free weather REST API service. The public REST API weather service provided by OpenWeatherMap.org. The weather REST API key and city name are passed as URL parameters. You can request the weather REST API by making HTTP GET requests.

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.

Search Map Objects by Address via REST API
Search the objects on the map next to the address by sending a POST request to the Mapquest.com REST API. Replace {mapquest_apikey} with your own Mapquest API key.

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.

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.

Current Weather Data by ZIP Code via REST API
This page shows how to get the current weather data by ZIP code by sending a GET request to the OpenWeather REST API. Replace {openweathermap_apikey} with your own API key.

Current Weather Data by Geographic Coordinates via REST API
This page shows how to get the current weather data by geographic coordinates by sending a GET request to the OpenWeather REST API. Replace {openweathermap_apikey} with your own API key.

Search Map Objects by Latitude and Longitude via REST API
Search the objects on the map using a latitude/longitude pair by sending a POST request to the Mapquest.com REST API. Replace {mapquest_apikey} with your own Mapquest API key.

IP Geolocation API Example
An example of getting the user's location by IP address. The free IP geolocation API service is provided by IPInfo.io. The IP geolocation API key is sent to the server in the Authorization: Bearer {apikey} request header. You can request the IP geolocation API service by making HTTP GET requests.

Exchange Rates API Example
An example of getting the latest foreign exchange rates by requesting the free foreign exchange rates and currency conversion REST API service. The real-time exchange rate API service is provided by Fixer.io. The exchange rates API key is passed as a URL parameter. You can request the free exchange rates API by making HTTP GET requests.

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.

HTTP Methods for CRUD Operations
The CRUD-based REST API maps CRUD operations to HTTP verbs in the following format: POST - create or add a resource, GET - request a resource, PUT - update an existing resource, PATCH - make partial changes and DELETE - delete a resource.

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