Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
devkeydet
Regular Visitor

"Operation is not supported for selector" when using "Update datasources" REST API

I am trying to automate the publishing of a .pbix file, then change the "url" value of the OData datasource, in order to have a way to automation deployment from dev->test->prod.  When I make an http post to:

https://api.powerbi.com/v1.0/myorg/groups/{valid-group-id}/datasets/{valid-dataset-id}/updatedatasou...
...with the following body:
{
  "updateDetails":[
    {
      "connectionDetails":
      {
        "url": "https://new-value.api.crm.dynamics.com/api/data/v8.2"
      },
      "datasourceSelector":
      {        
        "datasourceType": "OData",
        "connectionDetails": 
        {
          "url":"https://old-value.api.crm.dynamics.com/api/data/v8.2"
        }
      }
    }
  ]
}
...the status is 400 with an "Operation is not supported for selector".  However, according to my interpretation of https://msdn.microsoft.com/en-us/library/mt814715.aspx this should be supported.  Any thoughts on why I am getting this error?

5 REPLIES 5
v-ljerr-msft
Employee
Employee

Hi @devkeydet,

 

According to the documentation, we will get status 400 when:

  • Body contains multiple requests with the same datasource selector. 
  • Missing or empty updateDetails in body. 
  • Attempting to update a datasource with invalid connection details. 
  • Datasource type doesn't support update operation. 
  • Attempting to update a connection from cloud to on-premises or on-premises to cloud.

In addition, could you try the solution below to see if it works in your scenario?

 

1. Use Query Parameter in Data Source dialogs(url) to create a the dataset, so that you can change the data source by just modifying the corresponding Parameter.

 

2. Use the the  Set parameters operation(Power BI REST API) to dynamically change the Parameters in your code, which will also change the actual connection (url).

 

3. Use the  Patch data source operation to update the credentials for the changed data source. Reference: https://community.powerbi.com/t5/Developer/Patching-an-Online-DirectQuery-datasource/m-p/351230

 

Regards

Hi,

 

After looking around quite intensely, I believe there isn't an actual answer to the problem posed in this thread. At the moment I'm facing the same issue and am getting especially frustrated with the lack of more in depth information from the REST API.

I have a report that works just fine and for which the datasource can be changed when using the Power BI Desktop app. However trying to accomplish the same using the REST API's is failing.

I'm switching between practically identical databases, both cloud and both authenticated using Basic auth.
The body is (a bit redacted):

{
  "updateDetails": [
    {
      "datasourceSelector": {
        "datasourceType": "Sql",
            "connectionDetails": {
                "server": "server-one.database.windows.net",
                "database": "server-one-database-db"
            }
      },
      "connectionDetails": {
        "server": "server-two.database.windows.net",
        "database": "server-two-database-db"
      }
    }
  ]
}


The response I'm receiving is as follows:

{
    "error": {
        "code": "InvalidRequest",
        "message": "Operation is not supported for selector #23"
    }
}

And... well, that's it actually.

 

From the datasources fetch from the gateway they are listed as, from which I concluded they are authenticated just fine.

{
            "id": "<uuid>",
            "gatewayId": "<uuid of cloud gw>",
            "datasourceType": "Sql",
            "connectionDetails": "{\"server\":\"server-two.database.windows.net\",\"database\":\"server-two-database-db\"}",
            "credentialType": "Basic",
            "credentialDetails": {
                "useEndUserOAuth2Credentials": false
            }
        },{
            "id": "<uuid>",
            "gatewayId": "<uuid of cloud gw>",
            "datasourceType": "Sql",
            "connectionDetails": "{\"server\":\"server-one.database.windows.net\",\"database\":\"server-one-database-db\"}",
            "credentialType": "Basic",
            "credentialDetails": {
                "useEndUserOAuth2Credentials": false
            }
        }

 

Why would it be possible to switch datasources using the desktop app, but fail to do so using the REST API?
Is there a way to get a little bit more information from the API?

 

Regards,

 

Peter

I am facing the same exact issue right now. Did you get any traction?? @v-ljerr-msft  @petermoolenaar 

Hi @TexasBI ,

 

Eventually, support (after some escallation) was able to provide more details and (if memory serves me right) it turned out to be a column which combined (joined) information from tables. The documentation tells that combining information from different sources might be a problem, but apparantly any join could prove to be giving issues.

 

Regards,

 

Peter

Anonymous
Not applicable

I am geeting the same error when I select Update all datasources in workspace.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors