cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Error while creating a new datasource on a gateway using REST API

Request Body:

{

"datasourceType": "File",
"connectionDetails": "{\"path\":\"D:\\\\temp\\\\folderName\\\\dataFolder\\\\custPayData.xlsx\"}",
"datasourceName": "data_source_test_1_api",

"credentialDetails": {
"credentialType": "Windows",
"credentials":"{\"credentialData\":[{\"name\":\"username\", \"value\":\"DomainName\\UserName\"},{\"name\":\"password\", \"value\":\"password\"}]}",
"useEndUserOAuth2Credentials": false,
"encryptedConnection": "NotEncrypted",
"encryptionAlgorithm": "None",
"privacyLevel": "None"
}

}

Response :

{
"error": {
"code": "DMTS_InvalidEncryptionAlgorithmError",
"pbi.error": {
"code": "DMTS_InvalidEncryptionAlgorithmError",
"parameters": {},
"details": [],
"exceptionCulprit": 1
}
}
}

Headers:


header.PNG

 

 

 

3 REPLIES 3
Anonymous
Not applicable

Re: Error while creating a new datasource on a gateway using REST API

Joining in on the party. I have the same error when trying to add azure sql db's as datasources.

 

I can set the encryptionalgorithm to RSA-OAEP to avoid this error but then I get a 

 

{'error': {'code': 'UnknownError', 'pbi.error': {'code': 'UnknownError'}}}

 

Possibly because for cloud datasources it needs to be set to none according to the docs. But maybe it can help you to set EncryptionAlgorithm to RSA-OAEP (only accepted value according to docs) and see what happens.

tmschbgr Frequent Visitor
Frequent Visitor

Re: Error while creating a new datasource on a gateway using REST API

Same issue here. Considering that this post is already half a year old, has anyone found a solution to this?

tmschbgr Frequent Visitor
Frequent Visitor

Re: Error while creating a new datasource on a gateway using REST API

Found a solution to this. 

 

You need to encrypt your credentials first, before you can make the API call. Encryption method in C# is described here: https://docs.microsoft.com/en-us/power-bi/developer/encrypt-credentials

 

encryptionAlgorithm should be set to "RSA-OAEP"

 

See my stackoverflow post here: https://stackoverflow.com/questions/56961746/power-bi-api-post-datasource-errors-with-dmts-invaliden...

 

I am going to try and build a JS / Node based encryption function and will post here when successful.

Helpful resources

Announcements
Community Highlights

Community Highlights

Find out what's new in the Power BI Community!

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 359 members 4,061 guests
Please welcome our newest community members: