Systems Management Question

How do I login/authenticate through API on KACE 1000 System Management Appliance 7.0

09/06/2017 1865 views
Here is my python code:

# Import script for porting information from the KACE server

import requests

def main():
username = 'test'
password = 'test'
org_name = 'Default'

session = requests.session()
session.params = {'password': password,
'userName': username,
'organizationName': org_name}
session.headers = {'Accept': 'application/json',
'Content-Type': 'application/json',
'x-dell-api-version': '5'}

login_path = 'SERVER/ams/shared/api/security/login'

response = session.post(login_path)


if __name__ == '__main__':

I am able to log in manually through the browser with the account test and password test as an admin. However, when running the above code I get

<Response [401]>
{'errorCode': 29, 'errorDescription': 'Login Failed: Incorrect user name or password.'}

I've been stuck on this for more than an entire day at work. I need to get access to the API in order to run queries with scripts. I called customer support and they . made me wait for 1 hour before telling me no engineers were available. ANY help would be greatly appreciated. I want to be able to get a CSRF token with a status 200 response from the post request.

Thank you!
0 Comments   [ + ] Show comments


All Answers

Figured out the solution thanks to someone on stack overflow.

This part must be put into the data part of the request and not the params:

session.headers = {'Accept': 'application/json',
'Content-Type': 'application/json',
'x-dell-api-version': '5'}
Answered 09/07/2017 by: zel123
White Belt

This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ