API Call Fails

  • Trying to start using the CD API, but simply getting the token fails with the following code:
    import requests

    url = 'http://<x.x.x.x>/clonedeploy/api/token'
    params = {'grant_type': 'password', 'username': '<xxxxx>', 'password': '<xxxxx>'}

    headers = {'Content-Type': 'x-www-form-urlencoded'}
    req = requests.post(url=url, headers=headers, params=params)

    data = req.json()


    I've tried a password and Imaging Token, but the only thing I get back is:

    Any help is appreciated!

  • Nevermind, I figured it out.
    grant_type etc. have to be in a payload, not params.