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

Be 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

Reply
pdbenbow
Resolver II
Resolver II

Report Server REST API - PUT method failing

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.

6 REPLIES 6
Anonymous
Not applicable

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.

edugonz
Frequent Visitor

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))

hugoberry
Responsive Resident
Responsive Resident

By the way do you set "Content-Type: application/json" in your header?

 

v-yulgu-msft
Microsoft Employee
Microsoft Employee

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

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.