Overview
As you know, APIs are bridge between designed interface and backend. External APIs are offered by the third party to use their resources/features. They provide access of the functioning of the projects which can be a part of the new / existing project developed on Configure.IT.
You can simply, flawlessly add external APIs to the project you’re building on Configure.IT. To do this, go to API-configuration, follow the steps and finally, visit API Connector which you can make logic on the API workspace.
You can always explore more about API at API Configuration.
Process
Any API can be added to the project in the same easy way by clicking “Add New”.
Go to API-Connector and select the appropriate API- custom or external. The
parameters introduced here will be appended to the URL when the request to the API is sent.
Next, enter the input parameters in the API_output_parameters id, which will show up the response list in case of success.
On failure, click ‘configure’ and drag everything to the ‘choose_output_parameter’ and save. Then create a table to save these results. While adding data to the table, make sure that there are no duplication of rows.
Remove the right edge/line connecting the condition to the external API and click on the left side and drag it towards the external API. Insert and name the condition of the external API and then select ‘flow’ and ‘external api’ as operands.
On the right side of this condition, insert a query which will in turn insert the source into the table. In the query change batch_insert option to ‘yes’ and select into the fields in which the data is to be inserted. Furthermore, if a new record is to be added into the table, add and rename another query and then add a finish block. Enter some message and save.
On the left side of the condition, add a finish block and retitle it to failure. Check the error and change the status code to “bad-request”, success to “0” and message as failure and connect the success side of the condition to the query.
To test the API, click Refresh screen and later press execute, therefore, you can see the response from the API. If you see your table, you’ll notice it is filled with some rows. Click on execute to see if there is any duplication of data in the table. If there is no duplication then the API is working perfectly.
Now you can easily go ahead & add any external API to your project! What’s more, we’ve made it even easier for you, you can watch a detailed step by step of this process in a video tutorial we’ve made, using the open API by NASA.
Example - Instagram API
Let's have a look at one of the most popular example of getting Instagram followers details using API.
API Configuration
Go to “Add New API” which will redirect you on following screen.
Once you add general details of API, you will be redirected to configuration page . You just need to configure API using a simple flowchart structure as shown below.
See below screen of “External API” panel & configure it:
API Types - External :
It allows you to use external APIs directly such as Facebook, Instagram, Youtube etc. Choose Instagram.
- External API : Select any API from given APIs like Facebook, Youtube, Instagram etc.
- Service : Select Service that is to be called from given services such as get user profile or get followers information etc.
- Authentication : Authentication for a particular API.
- API URL : It will be automatically filled with the API URL.
- Add Headers : Headers can be added.
- API Method : Select any API method from GET / POST / PUT / DELETE / JSONPOST / XMLPOST.
- Input parameters : Based on selected API method , input params format gets changed and more Input Params can be included too.
Custom :
It allows you to add a custom URL.
Set the URL parameter with temporary data.
Set the Output Format
Single Key : allows you to have response in nested structure
- set sequence of output params
- set param as parent node / subnode
- apply PHP function on specific output param
- modify output param name by edit
See the image for the single key
Multiple Key : allows you to have response in simple - multiple key structure
Show Response :Shows you Request Headers , Response Headers and API Response in popup.
Just ‘Save’ settings to complete API configuration. After configuring “External API”, it allows you to process it further using different options like loop , condition etc.
Add “Finish” controller and “Finish” controller options to finish the flow. Select output params and set success message.
Now , “save settings” and execute it. It will show you data response in new window. It’s done now.
Example - Geographical tool - Google Map
Now a days, we need to make many geographical projects where you need to get or share map coordinates of your current location or of any particular address. So we have explained outlined the steps to to fetch latitude and longitude from address by using Google API.
- Add API to accept address as input parameter in detail page.
- Go to API configuration page and add API Connector flow block
- Add the Finish flow block and execute or debug the API
Here the external URL, i.e. Google API URL must be publicly accessible URL as local network URLs are unable to connect and fetch the data.
You can call MySQL API in SQLite by using Remote API Call, too.