Table of Content
Still need help?
Request support
Request Support
HELP
 / 
 / 
Data Processing Blocks
 / 

Get data from REST APIs

This article explains the Get data from REST APIs block in App Design.

Note: This block can pull data from any REST-based API that supports HTTP GET or POST methods and that accepts and returns JSON Payloads.

Also note that the API response should be a JSON Object. It cannot be a JSON Array or a string or a number.

Get data from REST APIs

Help video

Use Cases

  1. Getting Master data from company's existing APIs to fetch information of Customers, Employees, Vendors, Projects etc.
  2. Querying/filtering the Master data based on values entered by the end-user on Clappia.
  3. Getting live information of Currency exchange, weather etc from public APIs as part of the Clappia apps.

Editing the Block

Click on the block and start editing on the panel that appears on the right side.

Get data from REST APIs

Label

This is what appears as the label for the REST API block to the end user.

Server URL

REST API endpoint of the Server from where data needs to be pulled. Sample Server URL - https://apiv2.clappia.com/public/xx/getProjectById

The URL can be dynamic also. Type @ to see a list of all variables of the app.

Get data from REST APIs

 

Method Type

HTTP Method Type that the API works on. Choose from one of GET or POST.

Query String

Optional Query String that the API accepts. We can pass any variables from the current Clappia app to the query string arguments. Type @ to see a list of all variables of the app. The query String should follow the pattern -
?parameter1=value1&parameter2=value2& . . .

Get data from REST APIs

Headers

Headers in JSON format. Used to send attributes like API Keys, Content Type etc to the REST API.

Get data from REST APIs

Request JSON

Optional. JSON Payload for the API. Applicable only if Method Type is POST. This also accepts variables from the Clappia App. Type @ to see a list of all variables of the app.

Note: This should be a valid JSON. New line characters should not be present in the JSON.

Get data from REST APIs

Select fields from the API Response

This block assumes that the API Response is a JSON object. It cannot be an Array or a String or a Number. So let's say following is response of a GetCityByName API-

{
   "city_name": "Raipur",
   "state_name": "Chhattisgarh",
   "population": 1029198,
   "is_state_capital": true,
}

Now when the Clappia user enters the city name and fetches the city data from this API, we need to map the API Response to fields on Clappia. Let's say that we need only the city_name, state_name and is_state_capital fields in the Clappia App. So we enter the exact names of these three fields in the section.

Get data from REST APIs

Now when we save the details, we will see three new read-only fields created in the app. We can now change the labels of these fields.

Get data from REST APIs
FAQs
Try our free plan
It will answer many more questions within just 15 minutes.