Quantcast
Channel: All Developer posts
Viewing all articles
Browse latest Browse all 48289

Set AzureBlob Datasource key using REST API

$
0
0

Hi,

 

I have a report which I embedded to my application using pbie.

the report itself have been embedded successfully, but the dataset cannot be refreshed.

after some checking, I know that the dataset doesn't have enough credentials to access my datasource, which are a csv file in Azure Blob storage.

Now, if I manually add my azure blob credentials to my datasets from power bi workspace it could be refreshed.

But, I want to automatically set my credentials from my application which are written in javascript.

 

I tried to use this API first to get my gateway and Datasource ID

GET https://api.powerbi.com/v1.0/myorg/datasets/{datasetId}/datasources

 it went well and I got the information perfectly.

 

next step, I wanted to update my datasource credentials information using this API

PATCH https://api.powerbi.com/v1.0/myorg/gateways/{gatewayId}/datasources/{datasourceId}

 with my OAuth token as my Authentication header, and request body like below:

{ "credentialDetails": { "credentialType": "Key", "credentials": "{\"credentialData\":[{\"name\":\"key\", \"value\":\"JY63B8gVl9ltPAE0mEvty4Kbnt9lLcR9VqKuKXjhQM0LlGzLvK/tVIr/ewtcyu9Tm75i0uU3V+idDF/Oo3DzMw==\"}]}", "encryptedConnection": "Encrypted", "encryptionAlgorithm": "None", "privacyLevel": "None" } }

 

but it gave my 401 error with response :

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

 

can anybody give me a hint for where I done wrong?

or maybe if there are any other way to do this I would appriciate the infromation

 

bests,


Viewing all articles
Browse latest Browse all 48289

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>