Forum Discussion

5 Replies

  • yoavo's avatar
    yoavo
    Microsoft Employee

    Hi,

    Strange. Can you please post here the response to that binding request?

    Also, if dataset is not bounded to the Gateway, then some later operation (e.g., refresh) should fail, right? Can you also post here the details of such a failure (the response if Via the API, or if via PBI portal UI, the picture of the pop up of failure, opened to show failure details)?

  • Brown1MR's avatar
    Brown1MR
    Regular Visitor

    I'm trying similar thing through powershell using the Invoke-PowerBiRestMethod cmdlet.  I've used this successfully to show the gateways a dataset could be bound to so I know the cmdlet works.

     

    Invoke-PowerBiRestMethod -Url 'datasets/02e5300c-7414-4f67-b93f-aaa2a93$$$$$/Default.DiscoverGateways' -Method Get

     

    apon selecting one of the gatewayID's that are output above, I run the following :

     

    Invoke-PowerBiRestMethod -Url 'datasets/02e5300c-7414-4f67-b93f-aaa2a93$$$$$/Default.BindToGateway' -Body bd3c507e-a56c-4ec1-ba8f-7b31cbb##### -Method Post

     

    Getting the following error:

     

    Invoke-PowerBiRestMethod : One or more errors occurred.
    At line:1 char:1
    + Invoke-PowerBiRestMethod -Url 'datasets/02e5300c-7414-4f67-b93f-aaa2a ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : WriteError: (Microsoft.Power...werBIRestMethod:InvokePowerBIRestMethod) [Invoke-PowerBIRestMethod], Aggrega
    teException
    + FullyQualifiedErrorId : One or more errors occurred.,Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod

     

    then for more context :

     

    Write-Host $error[0].Exception
    System.AggregateException: One or more errors occurred. ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 400 (Bad Request).
    at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
    at Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod.<InvokeRestMethod>d__31.MoveNext()
    --- End of inner exception stack trace ---
    at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
    at Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod.ExecuteCmdlet()
    at Microsoft.PowerBI.Commands.Common.PowerBICmdlet.ProcessRecord()
    ---> (Inner Exception #0) System.Net.Http.HttpRequestException: Response status code does not indicate success: 400 (Bad Request).
    at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
    at Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod.<InvokeRestMethod>d__31.MoveNext()<---

     

    Why would this be reporting Bad Request

    please advice, thank you !

    • yoavo's avatar
      yoavo
      Microsoft Employee

      Hi,

      there are no details in your question except for the dataset Id, and the error you posted is way above what PowerBI returned, So without PowerBi's error message (or at least the requestId with which we can investigate, it's really  hard to know why your request failed.

      But I looked at your dataset activities 11/19-20  and I see many errors. Half are of invalid requests and the rest is because you send too many request in a short period, so some where rejected with a meassage asking to try a bit later.

      Hope this helps.

      Yoav (PBI staff)

      • jburbano's avatar
        jburbano
        Frequent Visitor

        I am having the same exact error.  I am building a powershell script to automate publishing.  I have enabled Fiddler and I can catch the 400 bad request, but when I repeat, the same exact request via fiddler...it works.  Is there indeed a timing thing?  I am doing a few API calls, pretty much back to back. I am getting an AAD token, followed by getting the groupid, then the reportid based on the name of the pbix file, to make sure the workspace and report exist and if so, need to be overwritten.  I then publish the pbix, followed by taking ownership of the dataset and setting parameters.  I then am trying to bind the dataset to a gateway using:

         

        https://api.powerbi.com/v1.0/myorg/groups/GroupId/datasets/DatasetId/BindToGateway

         

        To it I use the following body:

         

        {"gatewayObjectId": "GatewayId"}

         

         

        First attempt as part of the script I get a:

         

        HTTP/1.1 400 Bad Request
        Cache-Control: no-store, must-revalidate, no-cache
        Content-Type: application/json; charset=utf-8
        Strict-Transport-Security: max-age=31536000; includeSubDomains
        X-Frame-Options: deny
        X-Content-Type-Options: nosniff
        RequestId: 1507f40e-c4d3-4505-b18c-08d756c68599
        Date: Tue, 29 Jan 2019 05:10:55 GMT
        Content-Length: 189
        
        {"error":{"code":"DMTS_CanNotFindMatchingDatasourceInGatewayError","pbi.error":{"code":"DMTS_CanNotFindMatchingDatasourceInGatewayError","parameters":{},"details":[],"exceptionCulprit":1}}}

         

        But using Fiddler's Composer I clone the same EXACT request and get:

         

        HTTP/1.1 200 OK
        Cache-Control: no-store, must-revalidate, no-cache
        Content-Type: application/octet-stream
        Strict-Transport-Security: max-age=31536000; includeSubDomains
        X-Frame-Options: deny
        X-Content-Type-Options: nosniff
        RequestId: b8ce9e60-298d-4054-ae41-78d97c273898
        Date: Tue, 29 Jan 2019 05:15:46 GMT
        Content-Length: 0

         

        Please help. I am actually setting up an Azure DevOps Release pipeline to automate this process for my developers.

         

        Update:

         

        I have noticed that a 2 second sleep seems to help, but now I am getting this on the update parameters request:

         

        HTTP/1.1 429
        Cache-Control: no-store, must-revalidate, no-cache
        Transfer-Encoding: chunked
        Content-Type: application/json; charset=utf-8
        Strict-Transport-Security: max-age=31536000; includeSubDomains
        X-Frame-Options: deny
        X-Content-Type-Options: nosniff
        RequestId: e63505f6-bf41-4d22-94d8-d883188b4923
        Date: Tue, 29 Jan 2019 06:02:01 GMT
        
        7F
        {"error":{"code":"ActivityLimitReached","message":"UpdateDatasetParameters on c629a2a9-3932-4ce6-a5f6-1de659406843 throttled"}}
        0

         

        I think it is self explanatory.