Articles in this section
Category / Section

Create MongoDB data source via API

Published: Jan 09, 2024

Steps To Create a MongoDB data source via API call

Step 1:

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

Response Sample
image.png

Step 2:

  • Use the below endpoint in postman with POST method
    http://localhost:{Your_Portnumber}/bi/api/site/site1/v4.0/datasources
    Example

      http://localhost:52469/bi/api/site/site1/v4.0/datasources
    

image.png

Step 3:

Add this token in postman headers with key as Authorization and values as Bearer {Your_token}

image.png

Step 4:

  • Use below Raw Body with your MongoDB details, in Body section in Postman with format as JSON:

     {
          "Name":"DS_Name",
          "Type":"MongoDB", 
          "Connection":{
          "authenticationDatabase":"admin", 
          "authenticationType":"scram", 
          "database":"my_DB", 
          "collectionName":["my_collection "],
          "provider":"MongoDB",
          "isSelfSigned":false,
          "isSslEnabled":true, 
          "password":"my_password", 
          "port":12345, 
          "refreshInterval":"Never", 
          "username":"my_username", 
          "serverName":"my_servername", 
          "IsSshConnection":false, 
          "SshServerName":"",
          "SshPort":"5432",
          "SshUsername":"",
          "SshPassword":"", 
          "sslCertificateData":null, 
          "sslCertificatePassword":"", 
          "dataprovider":"MongoDB"
          },
          "RefreshSettings":{
          "StartTime":"2022-02-08T04:23:00Z",
          "NeverEnd":true, 
          "EndAfterOccurrence":1, 
          "ScheduleType":"Weekly",
          "WeeklySchedule":
          { "RecurrenceWeeks":1, 
          "RecurrenceDays":[
          "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"
          ]
          },
          "IsEnabled": true, 
          "FailureNotificationToOwner": true
          }
          }
    

image.png

Step 5:

  • Click send and your data source will be created.
  • On successful creation you will see the message as “Datasource published successfully”. You can check your data source page in Bold BI® for created data source.
    image.png

Additional References

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
SM
Written by Siranjeevi Murugan
Updated: Jan 09, 2024
Comments (0)
Please  to leave a comment
Access denied
Access denied