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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! 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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.