MicrosoftDocs / powerbi-docs

Creative Commons Attribution 4.0 International
444 stars 844 forks source link

Incorrect response for Dataset Refresh API #5067

Closed zhiweiv closed 2 days ago

zhiweiv commented 2 months ago

In my testing

Request

POST https://api.powerbi.com/v1.0/myorg/groups/8449ff8d-xxxx-48f9-b4e0-a34396e9c233/datasets/4ee29404-xxxx-4d34-bc02-6971f432cecd/refreshes HTTP/1.1
Host: api.powerbi.com
Authorization: Bearer xxxx
User-Agent: FxVersion/8.0.324.11423 OSName/Windows OSVersion/Microsoft.Windows.10.0.22621 Microsoft.PowerBI.Api.PowerBIClient/4.18.02511.1
Content-Length: 0

Response

HTTP/1.1 202 Accepted
Cache-Control: no-store, must-revalidate, no-cache
Pragma: no-cache
Content-Type: application/octet-stream
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Frame-Options: deny
X-Content-Type-Options: nosniff
RequestId: a76a1418-3135-4e23-a4f5-9ee260167f95
Access-Control-Expose-Headers: RequestId
request-redirected: true
home-cluster-uri: https://wabi-us-east2-b-primary-redirect.analysis.windows.net/
Date: Wed, 20 Mar 2024 07:22:43 GMT
Content-Length: 0

It is completely different with https://learn.microsoft.com/en-us/power-bi/connect-data/asynchronous-refresh#response.

The content is wrong also in https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/refresh-dataset-in-group#response.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

bishalgoswami commented 2 months ago

Thanks for your comment, @zhiweiv. This issue has been assigned to the doc author for review.

kfollis commented 1 month ago

@KesemSharabi - assigning this to you for review and verification. I think the example shows just the first line then has text that explains the rest of the response. We may need to reformat to make that clear

zhiweiv commented 1 month ago

Adding some more details, the document says there is Location value in response header which is in URL format, we need to extract the requestId from the Location value.

The real response is that RequestId is returned in header directly, and there is no Location value returned.

KesemSharabi commented 2 weeks ago

Hi @zhiweiv,

When triggering an enhanced refresh the two headers are being returned, otherwise they aren’t returned. According to the documentation 'An enhanced refresh is triggered only if a request payload other than notifyOption is set.' - perhaps add something like: "retryCount": 3 to your request?

Hope this helps,

Kesem

zhiweiv commented 2 weeks ago

Many thanks, now things get clear.

Standard refresh return only one header: RequestId. Enhanced refresh return both RequestId and Location.

The document https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/refresh-dataset-in-group#example-of-refreshing-a-dataset only lists Location in sample response which is a bit confusing.

In my case RequestId is more handful, since I use Power BI SDK to query refresh status by request id. I can get request id directly from response header RequestId without parsing URL of Location.

KesemSharabi commented 2 days ago

Hi @zhiweiv - I'm glad this is clear now. Thanks for engaging with us!