Forum Discussion

JoergSch's avatar
JoergSch
Frequent Visitor
5 years ago
Solved

Gateway ODATA datasource creation via API

Hello,

 

I am currently trying to create an OData datasource via the Gateway - Create Data source API (Gateways - Create Datasource (Power BI Power BI REST APIs) | Microsoft Docs).

 

When I put in the JSON and execute, I am getting below error.

 

{
  "error": {
    "code": "BadRequest",
    "message": "Bad Request",
    "details": [
      {
        "message": "Unexpected character encountered while parsing value: {. Path 'connectionDetails', line 11, position 27.",
        "target": "datasourceToGatewayRequest.connectionDetails"
      },
      {
        "message": "'datasourceToGatewayRequest' is a required parameter",
        "target": "datasourceToGatewayRequest"
      }
    ]
  }
}

 

The Input JSON looks as following:

 

{
    "datasourceName":  "My_ODATA",
    "credentialDetails":  {
                              "encryptedConnection":  "Encrypted",
                              "credentialType":  "Basic",
                              "credentials":  "mSTkW...dEwQ==",
                              "privacyLevel":  "Private",
                              "encryptionAlgorithm":  "RSA-OAEP"
                          },
    "dataSourceType":  "OData",
    "connectionDetails":  {\"url\":\"https://myURL.com\"}
}

 

Whats wrong with that?

 

How can I create an OData data source via the API?

 

Thanks

 

Joerg

 

  • Thanks Xiaoxin,

     

    I found the reason in the meantime. The parameter 

    "useEndUserOAuth2Credentials": false,

    was missing. The error message was a little bit misleading.

    Joerg

2 Replies