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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
amankhandelwal
Regular Visitor

Create Dataset from a Postgresql datasource using REST API

Hello,

 

I created a datasource behind gateway for using rest API. Datasource got created. However, now I want to add a table(create a dataset) from the created datasource to use it in a report. However, I am getting the below error from API.

 

 

 

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

 

 

 

My API request body:

 

 

{
	"datasources": [
        {
            "gatewayId":"gateway_id",
            "datasourceId": "datasource_id",
            "datasourceType": "PostgreSql",
            "connectionDetails": "{\"server\":\"server_address\",\"database\":\"database_name\"}",
            "credentialType": "Basic",
            "credentialDetails": {
                "privacyLevel": "None",
                "useEndUserOAuth2Credentials": false
            }
        }
    ],
	"defaultMode": "Push",
	"name": "API DS 1",
	"tables": [
        {
            "name":"currency_rates",
            "description": "DS Table 1 Demo API",
            "columns":[
                {
                    "name":"id",
                    "dataType":"Int64"
                },
                {
                    "name":"traded_on",
                    "dataType":"DateTime"
                },
                {
                    "name":"currency_code",
                    "dataType": "string"
                },
                {
                    "name":"close",
                    "dataType": "Double"
                }
            ]
        }
    ]
}

 

 

 

Not sure what is wrong here.

API Reference: https://learn.microsoft.com/en-us/rest/api/power-bi/push-datasets/datasets-post-dataset-in-group

2 REPLIES 2
amankhandelwal
Regular Visitor

@jaweher899  by PowerBI service logs you meant the one mentioned in this documentation link: https://learn.microsoft.com/en-us/power-bi/admin/service-admin-auditing

 

Or something else?

jaweher899
Impactful Individual
Impactful Individual

The error message "FailedToDeserializeDatasetError" usually indicates that the JSON payload sent to the API is not in the expected format. It's possible that there is a syntax error or some missing information in your request.

Here are a few things you can check:

  1. Make sure the "datasourceId" in your request matches the ID of the datasource you created earlier.
  2. Verify that the gateway ID is correct and that the gateway is online and available.
  3. Double-check the JSON payload and make sure that all the required fields are included. You can use a JSON validator to check the syntax.
  4. Check the Power BI service logs for any additional error messages that may provide more details on the issue.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.