Introduction
When you have created the Consume Web API file, you can configure it at any time. The main aspects you can configure are the content type, request type, parameters and schema.
Prerequisites
The file you need must already exist.
|
Quick Steps |
| 1 |
Open the Consume Web API file |
| 2 |
Update the file details |
| 3 |
Click URL/Params |
| 4 |
Enter the parameter details, then click OK |
| 5 |
Click Get Schema |
| 6 |
Enter the parameter values, then click Send |
| 7 |
Select the desired fields and collections, then click Update Schema |
| 8 |
Save the file |
Detailed Steps
Step 1. Open the Consume Web API file.
Open the file you want to configure. This example uses wpiGetCovidData.
Step 2. Update the file details.
The important properties are:
- ID: Name of the Web API file.
- Content Type: Determines which type of content is returned. There are three types: JSON, XML, and PLAIN. In this example, the Content Type is JSON.
- Request Type: Determines the below HTTP methods:
- GET: It is used to retrieve data from a specified resource. In this example, the Request Type is GET.
- POST: It is used to send data to the specified resource.
- PUT: It is used to send data to update or create a new resource. When a PUT request is sent, the entire resource is replaced with the new data. If the resource does not exist, it will be created.
- DELETE: It is used to delete the specified resource.
- PATCH: It is used to update the desired data in the specified resource by sending only those fields of the resource in the request body.
Step 3. Click URL/Params.
Here you will add the parameter you want to consume the data for.
Step 4. Enter the parameter details, then click OK.
Enter the URL for the specified resource parameters you want to consume to get the data. This example uses statistics?country={Country}.
Select the data type for the parameter. For this example, it is string.
Step 5. Click Get Schema.
The resource will provide schema for the data.
Here, you will get the data in a particular format or schema.
Step 6. Enter the parameter values, then click Send.
You have already provided the API key. Now you must enter the desired value of that parameter.
In this example, the key is Country and the value is USA.
Step 7. Select the desired fields and collections, then click Update Schema.
When you click Send, Xelence displays the schema. If you want a field or collection included, make sure it is checked. Xelence displays a preview of the data.
Step 8. Save the file.
Xelence creates and displays the schema. This file is considered usable without further configuration.
#WebAPI