/build/static/layout/Breadcrumb_cap_w.png

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

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)


print(response)
print(response.json())

if __name__ == '__main__':
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

Answers (1)

Posted by: zel123 6 years ago
White Belt
1
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'}

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
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