SSRS Session API

MrOutside 1 Reputation point

I have a python app that i am building that needs to delete and upload images to SSRS.
The issue i have is to authenticate against the ssrs api the documentation says i should specify username, password and domain and should get a token back.
For some reason i keep getting 401 or 400 error when i try to generate a session.

i am using the api documentation here:

Here is the part of my code that will not authenticate i have no idea why

user = ''
pwd = ''
domain = ''
report_url = ''

import requests
import json
class ssrs():

def __init__(self,Org,user,pwd):                = Org
    self.user               = user
    self.pwd                = pwd
    self.verifcationErrors  = []

def authorize(self):

        self.url = f"http://{}/reports/api/v2.0/Session"
        self.payload = json.dumps({"username": f"{self.user}","password": f"{self.pwd}"})
        self.header = {'Content-Type': 'application/json', 'Accept': 'application/json'}
        self.response = requests.request("POST", self.url, headers=self.header, auth=self.payload)
        return self.response.status_code
    except Exception as e:
        return e

var = ssrs(Org=report_url,user=user, pwd = pwd).authorize()

Looking for some help on others that have been able to successfully connect to ssrs and run rest api commands

pd: i also tried using

from requests_negotiate_sspi import HttpNegotiateAuth

to provide credentials and it didn't work either

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.
2,873 questions
Microsoft Partner Center API
Microsoft Partner Center API
Microsoft Partner Center: A Microsoft website for partners that provides access to product support, a partner community, and other partner services.API: A software intermediary that allows two applications to interact with each other.
328 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Isabellaz-1451 3,616 Reputation points

    Hi @MrOutside

    Sorry,I am not familiar to the python.
    Here is a sample code about deploying a custom security extension to SQL Reporting Services 2017,you may take a reference.
    and here is the article I take reference:
    Hope this will help you.

    Best Regards,

    If the answer is the right solution, please click "Accept Answer" and upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments