Obtain the System IDs under an NX Cloud account via an API



1 comment

  • Avatar
    Andrey Terentyev


    Yes, that's possible.

    You could use Cloud API, documented here https://meta.nxvms.com/cdb/docs/api/v1/swagger/index.html#/

    The endpoint you need is /cdb/system/get

    Before invoking it, you should authenticate to the Cloud. Here is a code example  https://github.com/networkoptix/nx_open_integrations/blob/master/python/examples/authentication/cloud_bearer.py

    Here is how you could modify the code to get information needed.

    def main():
    oauth_payload = create_payload()
    oath_response = request_api(CLOUD_URL, f'/cdb/oauth2/token', 'POST', json=oauth_payload)
    primary_token = get_token(oath_response)

    oath_response = request_api(CLOUD_URL, f'/cdb/oauth2/token', 'POST', json=oauth_payload)
    secondary_token = get_token(oath_response)

    primary_token_header = create_header(primary_token)

    system_info = request_api(CLOUD_URL, f'/cdb/system/get', 'GET',
    headers=primary_token_header, verify=False)

    secondary_token_header = create_header(secondary_token)

    request_api(CLOUD_URL, f'/cdb/oauth2/token/{primary_token}', 'DELETE', headers=secondary_token_header)
    Comment actions Permalink

Please sign in to leave a comment.