API Endpoints¶
Endpoints are essential for an API because they define the specific URLs or routes that clients can use to interact with the API. Each endpoint represents a different functionality or resource provided by the API. Using endpoints, clients can send requests to retrieve or manipulate data from the API. Endpoints help maintain a clear structure and organization for the API, allowing developers to understand and utilize its capabilities effectively.
Manage Endpoints¶
API Manager while onboarding an API enables developers to add endpoints with path, method and content type. Furthermore, they can add custom headers, query parameters, response schema and form data directly from the API Manager while onboarding the API or later whenever needed.
The supported endpoint methods are:
- GET
- PUT
- POST
- PATCH
- DELETE
The supported endpoint content types are:
- application/json
- application/x-www-form-encoded
- multipart/form-data
- application/xml
If you have onboarded an API and need to manage the endpoints, follow the below sections:
Note
The user role required to add endpoints for an API is platform-admin, api-product-manager or api-developer.
Add¶
- Go to Manage APIs → select My APIs.
- Click for the API you need to add the endpoints.
Note
If the API is published, you need to unpublish it first. Visit Unpublish API.
- Scroll down to the Manage Endpoints and click Edit.
Uploading Open API file¶
If you need to register multiple endpoints at once, then you can do that by uploading an OpenAPI file. To do so:
- Go to the Open API File section and click Upload.
- In the popup shown, enter the file Version number.
- Then, click Select File. Browse the file on your device and select it.
- After selecting the file, click Upload.
(Todo) Example of Swagger file needs to be added here
Registering endpoints manually¶
If you need to register the endpoints manually, then in that case, you can follow the below steps:
- In the Manage Endpoints click Add next to the Endpoint section.
- In the popup shown, enter the Endpoint details in the fields as appropriate:
- Enter the Endpoint Name
- Then, Endpoint Path
- Select the Method - GET | PUT | POST | DELETE | PATCH
- Then, select the Content Type - application/json | application/x-www-form-encoded | multipart/form-data | application/xml
- Add the Description
- Click Add Endpoint.
This will add the endpoint for the API.
If you need to add multiple endpoints, you can simply repeat this step and choose a different Method and Content Type according to the requirements.
Edit¶
In order to edit an endpoint(s), you need to:
- Access Manage APIs → My APIs → click for the API you need to edit the endpoint.
- On the API details page, scroll down to the Manage Endpoints.
- Select the endpoint.
- Then, in the window opens, make your changes.
Info
Fields with asterisk (*) are mandatory.
- Once done, click Update.
If you need to update another endpoint, simply select it from the same window and apply the changes, once done, click Update and it will edit the endpoint.
After this, click Back and Save the edit for the API.
Delete¶
To delete an endpoint(s), you need to:
- Access Manage APIs → My APIs → click for the API you need to edit the endpoint.
- On the API details page, scroll down to the Manage Endpoints.
- Select the endpoint.
- Then, click Delete.
- Click Delete in the popup shown to confirm.
Define custom headers; query parameters, response schema and form data¶
The endpoints you can add to the API also support custom headers, query parameters, response schema and form data. With these, you can provide additional flexibility and functionality to the API. For example, custom headers allow specifying additional information in the HTTP request headers when interacting with the API. Whereas Query Parameters are used to pass specific information to the API in the URL.
This is helpful for authentication, specifying content types, or filtering data returned by the API based on the requirements.
By adding response schema, one can define the structure and format of the data returned by the API to ensure consistency and clarity in the API responses, which ultimately makes it easier for developers to understand and consume the data.
The Form Data object sends structured data as part of a request body, typically when submitting data or performing operations that require complex input.
The API Manager supports these and by following the below sections, you can add them to your endpoints:
Add Headers¶
You can specify custom headers to be passed to your API endpoint by the user.
- To add a header:
- Access Manage APIs → My APIs → click for the API you need to edit the endpoint.
- On the API details page, scroll down to the Manage Endpoints.
- Select the endpoint.
- Navigate to the Headers and click Add.
- Then in the popup shown:
- Enter header Name
- Specify header Description
- Then, select the Type - String | Number | Boolean
- If you select String or Number:
- Enter the Value
Info
Fields with asterisk (*) are mandatory.
- If you select Boolean:
- Select the Value as True or False
- Then, select Mandatory or Optional
- Click Add header
This will add the custom header for the endpoint. Likewise, you can add custom header(s) for other endpoints. Simply, click on the endpoint button and repeat the steps.
Add Query Parameters¶
Adding a Query Parameter can be used to add additional parameters to a request. For example, a query parameter might be used to search a string that contains a specific keyword.
To add a query parameter:
- Access Manage APIs → My APIs → click for the API you need to edit the endpoint.
- On the API details page, scroll down to the Manage Endpoints.
- Select the endpoint.
- Navigate to the Query parameter and Add.
- Then in the popup shown:
- Enter parameter Name
- Specify parameter Description
- Then, select the Type - String | Number | Boolean
- If you select String or Number:
- Enter the Value
Info
Fields with asterisk (*) are mandatory.
- If you select Boolean:
- Select the Value as True or False
- Then, select Mandatory or Optional
- Click Add Query Parameters.
This will add the query parameters for the endpoint. Likewise, you can add the query parameters for other endpoints. Simply, click on the endpoint button and repeat the steps.
Add Response Schema¶
To add a response schema:
- Access Manage APIs → My APIs → click for the API you need to edit the endpoint.
- On the API details page, scroll down to the Manage Endpoints.
- Select the endpoint.
- Navigate to the Response schema and click Add**.
- Then in the popup shown:
- Enter response schema Name
- Specify response schema Description
- Then, select the Type - String | Number | Boolean | Array | Modal
Info
Fields with asterisk (*) are mandatory.
- If you select String, Number, Array or Modal:
- First, enter the Status Code
- Then, Value
- If you select Boolean:
- Select the Value as True or False
- Then, enter the Status Code
- Once you’ve added the values, click Add Response Schema.
This will add the Response schema for the endpoint. Likewise, you can add the Response schema for other endpoints. Simply, click on the endpoint button and repeat the steps.
Add Form Data¶
Only the PUT, POST, PATCH and DELETE endpoints support the Form Data object. To add it to the endpoint:
- Access Manage APIs → My APIs → click for the API you need to edit the endpoint.
- On the API details page, scroll down to the Manage Endpoints.
- Select the endpoint.
- Navigate to the Form Data and click Add**.
- Then in the popup shown:
- Enter Form Data Name
- Specify Form Data Description
- Then, select the Type - String | Number | Boolean | Modal | Xml
- If you select String or Number:
- Enter the Value
Info
Fields with asterisk (*) are mandatory.
- If you select Boolean:
- Select the Value as True or False
- If you select Modal:
- Enter the Modal Value
- If you select Xml:
- Enter the Xml Value
- Select Mandatory or Optional
- Then, click Add Form Data.
This will add the Form Data for the endpoint. Likewise, you can add the Form Data for other endpoints. Simply, click on the endpoint button and repeat the steps.
Edit or Delete (Headers, Query Parameters or Response Schema)¶
If you need to delete the custom parameters added to the endpoints, simply follow the below steps:
- Access Manage APIs → My APIs → click for the API you need to edit or delete the parameters.
- On the API details page, scroll down to the Manage Endpoints.
- Select the endpoint.
- Select the parameter
- Then, click Edit or Delete.
- If you select Edit:
- Apply changes in the popup
- Then, click Update
- If you select Delete:
- Then, click Delete again in the popup shown to confirm
This will simply update or delete the endpoints parameters.