Articles in this section
Category / Section

Create/Delete Custom Connector using API Calls

Published:

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

image.png

image.png

Response Sample

image.png

Create a Custom Connector via API

Follow these steps to create a custom connector using API calls:

  1. 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

  2. Then add the token generated from the /token endpoint above in Postman Headers with key as ‘Authorization’ and value as ‘Bearer {Your_token}

    image.png

  3. 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.

  1. Click Send. On successful request the custom connector will be created and can be found under Settings > Connectors.
    image.png

Response

  • 200 OK - Custom connector created successfully.
    image.png
  • 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:

  1. 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}
    image.png
  2. Click Send. On successful request the custom connector will be deleted and will be removed from Settings > Connectors.
    image.png

Response

  • 204 - No Content - Custom connector deleted successfully.
    image.png
  • 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

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
BK
Written by Baskaran K
Updated:
Comments (0)
Please  to leave a comment
Access denied
Access denied