Create/Delete Custom Connector using API Calls
This article explains how to create and delete the custom connector using API calls in Bold BI On-Premises using Postman.
Create a new Token
Use the /token API for generating the access token.
Request Body Schema:
username - string (Email address of the user)
password - string (Password of the user)
grant_type - string
The type of credentials used to authorize the request for an access token.
Value allowed is password.
Request Sample
Response Sample
Create a Custom Connector via API
Follow these steps to create a custom connector using API calls:
-
Use the below endpoint in postman with POST method
http(s)://{your host}:{your port number}/bi/api/site/site1/v5.0/datasources/custom-connector -
Then add the token generated from the /token endpoint above in Postman Headers with key as ‘Authorization’ and value as ‘Bearer {Your_token}’
-
Add the following details needed to create Custom connectors in the Raw Body using the below format:
{
"Name": "",
"Description": "",
"ConnectionJson":""
"Variables" :[]
}
For Example:
{
"Name": "basic-auth-with-flexiable-variable",
"Description": "my sample connector",
"ConnectionJson": "{\"Tags\":[\"basic\"],\"Template\":{\"Method\":{\"value\":\"get\",\"isHidden\":false},\"AuthenticationType\":{\"value\":\"basic\",\"isHidden\":false},\"Username\":{\"value\":\"<<:a1>>\",\"ishidden\":false},\"Password\":{\"value\":\"ghp_xyz\",\"ishidden\":false},\"DataFormat\":{\"value\":\"json\",\"isHidden\":false},\"URL\":{\"value\":\"https://raw.githubusercontent.com/syncuser/MockAPI/main/BoldBI/Sample.json\",\"isHidden\":false}}}",
"Variables": [
"{\"name\":\"variable1\",\"Id\":\"a1\",\"defaultValue\":\"xyz\",\"isHidden\":false,\"isRequired\":true}"
]
}
Refer this documentation for Custom connector JSON template
The ConnectionJSON and Variables properties value should be converted to valid JSON string format.
- Click Send. On successful request the custom connector will be created and can be found under Settings > Connectors.
Response
- 200 OK - Custom connector created successfully.
- 400 Bad Request - Invalid Body syntax - Connector name or Connection JSON is invalid or Empty.
- 401 Unauthorized - Authorization toke is invalid, or token has expired.
- 409 Conflict - Connector name already exists.
Delete a Custom Connector via API
Follow these steps to delete a custom connector using API call:
- Use the below endpoint in postman with DELETE method.
http(s)://{your host}:{your port number}/bi/api/site/site1/v5.0/datasources/custom-connector/{:connector name}
2.Then add the token generated from the /token endpoint above in Postman Headers with key as ‘Authorization’ and value as ‘Bearer {Your_token}’
- Click Send. On successful request the custom connector will be deleted and will be removed from Settings > Connectors.
Response
- 204 - No Content - Custom connector deleted successfully.
- 401 Unauthorized - Authorization toke is invalid, or token has expired.
- 417 Expectation Failed - Custom Connector file is not available.
Please ensure that the custom connector is enabled before attempting to create or delete it via the API.
Reference