March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Power BI report server version 1.1.6514.9163 (October 2017)
I'm writing a Python app to interact with the REST API. I'm pretty new to OData and REST, and so far I've successfully called several GET methods, but I started having a lot of trouble as soon as I switched over to PUT, POST, PATCH, etc.
Here's a snippet of my Python which invokes the PUT method to update a given report's description field in the Catalog. I've been doing my best to mirror the documentation on SwaggerHub here.
def update_report(self, report_id, description): path = self.path + '/CatalogItems({:s})/Properties'.format(report_id) payload = {"description": description} return requests.put(path, # data = json.dumps(payload), json = payload, auth = HttpNtlmAuth(self.username, self.password))
myResponse = rs.update_report(
"67d2c423-aeb5-4893-8db8-d6ae59dff412",
"This is a test to update the report description")
When I run this code, the Python console spits back the following error:
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://localhost/PBIReports/api/v2.0/CatalogItems(67d2c423-aeb5-4893-8db8-d6ae59dff412)/Properties
And this is the response I'm getting from the service:
{ "error":{ "code":"","message":"No HTTP resource was found that matches the request URI 'http://localhost/PBIReports/api/v2.0/CatalogItems(67d2c423-aeb5-4893-8db8-d6ae59dff412)/Properties'.","innererror":{ "message":"No action was found on the controller 'CatalogItemsController' that matches the request.","type":"","stacktrace":"" } } }
Any ideas as to what I'm doing wrong? The JSON payload should be in good shape, and I know the auth works fine because it works on all my GET calls.
Hi @pdbenbow
Did you resolve this?
I seem to encounter the same issue on our report server when trying to update connectionstring in an embedded datasource. The get request works as expected.
Server Version 1.5.7074.36177 (May 2019)
This is the code I´m using and getting 400 Bad request.
Any ideas?
import json import requests from requests_negotiate_sspi import HttpNegotiateAuth uri = 'http://###/api/v2.0/PowerBiReports(0d78ce2d-35a4-424a-8c4a-42556b91776c)/DataSources' payload = {'ConnectionString': 'data source=###;initial catalog=###;persist security info=false'} headers = {'Content-type': 'application/json'} r = requests.patch(uri, auth=HttpNegotiateAuth(), json=payload, headers=headers) #r = requests.get(uri, auth=HttpNegotiateAuth()) print(r.status_code) print(r.content) print(r.headers) print(r.json)
I never attempted to resolve the issue because this was not a high-priority project for me. I haven't tried any of the suggestions offered by other users, but there's probably some good advice there if you want to try to resolve it.
Just by looking at the code snipped it seems that you are sending a plan json object, but the API expects an array. The shape of the object that you are sending is also incorrect, it should be an object with two properties (name, value))
By the way do you set "Content-Type: application/json" in your header?
Hi @pdbenbow,
Unfortunately, I am not familiar with this problem. After research, I could not find the specific cause to this error.
@mgmeyer and @jtarquino might have any comment on this problem.
Regards,
Yuliana Gu
have you tried a different URL? For example I've succesfully made PUT calls to
http://localhost/reports/v2.0
Also if you are familliar with PowerShell have a look at https://github.com/Microsoft/ReportingServicesTools
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 |
User | Count |
---|---|
4 | |
4 | |
4 | |
3 | |
3 |