400 error on creating a report using SSRS Rest Api from c# code (ASP core 3.1)

Shashwat Bisoyi 11 Reputation points
2021-03-01T07:36:02.37+00:00

Hi,
I am getting a 400, bad request error when trying to create a new report using the rest api of ssrs as documented here: https://app.swaggerhub.com/apis/microsoft-rs/SSRS/2.0#/

However, I am able to retrieve all the reports and create a folder using similar request. So I suspect the 400 error is in the formatting of json that I am sending (maybe the content variable?). The current json:

{  
  "hasDataSources": true,  
  "hasSharedDataSets": true,  
  "hasParameters": true,  
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",  
  "name": "Test_Report",  
  "description": "",  
  "path": "/Folder/subfoler/Test_Report",  
  "type": 3,  
  "hidden": false,  
  "size": 0,  
  "modifiedBy": "User",  
  "modifiedDate": "2021-02-19T11:26:05.323Z",  
  "createdBy": "User",  
  "createdDate": "2021-02-19T11:26:05.323Z",  
  "parentFolderId": "21755bc5a-7a38-4d42-b2de-45c9cacef217",  
  "contentType": "application/json",  
  "content": "{\"Name\":\"Test\"}",  
  "isFavorite": false  
}  

The type in the json is an enum with 3 referring to "Report" and 11 to "Report Model". I tried both and still the same 400 error.
Here are the response headers:

72838-image.png

edit: fixed quotation mark(my bad) but it is not the problem

Developer technologies | ASP.NET | ASP.NET Core
SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
3,066 questions
Developer technologies | C#
{count} votes

1 answer

Sort by: Most helpful
  1. Duane Arnold 3,216 Reputation points
    2021-03-01T17:26:25.593+00:00

    Somehow the Json is malformed, and you need to find out why. Offhand, I can't remember some of the Json tools you can use to check the validly of Json data, but they are out there. Maybe you can download a 30 day trial one and check the Json.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.