Category / Section
Create MongoDB data source via API
Published:
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
Response Sample
Step 2:
-
Use the below endpoint in postman with POST method
http://localhost:{Your_Portnumber}/bi/api/site/site1/v4.0/datasources
Examplehttp://localhost:52469/bi/api/site/site1/v4.0/datasources
Step 3:
Add this token in postman headers with key as Authorization and values as Bearer {Your_token}
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 } }
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.