/build/static/layout/Breadcrumb_cap_w.png

API Access in KACE1000 Version 12.0.149

Hi everyone,


until the last versions of KACE 1000 we used WSAPI to connect our linux based machines to KACE.

Now we got the information, that this way is out of date and we need to use the "regular" API.


I think there is a fundamental problem because when we run the url: https://kace/api/inventory/machines

It shows: {"error": "API disabled."}


But I can not find a way to enable the API support.

Can you help me with this?


We use the version:
Model: K1000
Hardware Model: Virtual (VMware/Hyper-V/Nutanix)
Version: 12.0.149
-> we also set up two organisations

Thanks

Alex


0 Comments   [ + ] Show comments

Answers (2)

Posted by: KevinG 2 years ago
Red Belt
0

You start with a POST request to authenticate to the SMA server.

http://<YourSMA>/ams/shared/api/security/login

See the API documentation for more details. https://support.quest.com/download/downloads?id=6116975


Save theĀ  x-kace-csrf token to be used in subsequent API calls.

You may want to search previously posted questions regarding the API, as many have code examples.

What programming language do you plan to use with the API?

Comments:
  • Thanks for your help!

    We used Python in the past with WSAPI, so we would like to keep Python :-)
    I saw your other examples and tried it with these but still get error messages.

    I created a new user in KACE for the API-usage with admin rights in /systemui/settings_users_list.php (Settings-> Administrators).

    Error messages:
    {
    "errorCode": -1,
    "errorDescription": "Invalid CSRF Token"
    }


    {
    "errorCode": -1,
    "errorDescription": "Invalid user or password"
    }

    The code is:
    import requests
    import json

    from requests.sessions import Session
    session = Session();

    # Start of POST to authenticate to SMA server.
    # The x-dell-csrf-token is saved to be used in subsequent API calls.
    # Change the URL IP and credentials for your environment.

    url = "https://.../ams/shared/api/security/login"


    payload = json.dumps({ "userName": "...",
    "password": "...",
    "organizationName": "..."
    })


    headers = { 'Accept': 'application/json',
    'Content-Type': 'application/json',
    'x-dell-api-version': '5'
    }

    #To avoid SSL-error messages:
    session.verify = False

    response = session.post(url, headers=headers, data=payload)
    # The following line will display the JSON returned from the response.
    print(json.dumps(response.json(), indent = 3))
    csrf_token = response.headers.get('x-dell-csrf-token')

    # You should see the x-dell-csrf-token in the print output
    print(csrf_token)


    # The following API call will retrieve the list of devices on the SMA

    url = "https://.../api/inventory/machines"

    headers = { 'Accept': 'application/json',
    'Content-Type': 'application/json',
    'x-dell-api-version': '5',
    'x-dell-csrf-token': csrf_token
    }

    response = session.get(url, headers=headers)
    print(json.dumps(response.json(), indent = 3))

    session.close() - Alex-2k19 2 years ago
    • ok.... the script is good!

      It's all about my user!

      KACE doesn't use the user I created under "/systemui/settings_users_list.php (Settings-> Administrators)".

      Even with a new user I created under "/adminui/user_list.php (Settings -> User)" it was not working!

      We do authenticate the KACE users against Active Directory so I tried it with an AD user and it was working like a charm! - Alex-2k19 2 years ago
Posted by: Hobbsy 2 years ago
Red Belt
-2

I would suggest that you download the latest API guide hereĀ 


https://support.quest.com/technical-documents/kace-systems-management-appliance/11.0%20common%20documents/api-reference-guide


If, once you have verified the commands that you are using are correct and still come back with an error, then I suggest you log a call with Support


Let's just hope that Quest are not returning to the Bad old days from a few years ago when they didn't bother top keep the API up to date......... Good Luck

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