I enabled authentication on my opscenter node as per this . I've a python script that periodically invokes opscenter actions through the Opscenter REST APIs. From the REST API documentation, it looked like all I had to do was invoke these methods with basic HTTP auth (see this). But these calls always failed with a "user must be logged in" error.
After poking around the javascript that runs when I use the opscenter's web frontend, I figured that I must actually invoke the login method to create a session and use that session to invoke other methods, such as:
session = requests.Session()
login_body = '{"username": "%s", "password": "%s"}' % (opsc_uname, opsc_pwd)
login_resp = session.post("http://{url}/login".format(url=opsc_url), data=login_body).json()
clusterconf = session.get("http://{url}/cluster-configs".format(url=opsc_url)).json()
Is the api documentation (that claims to use basic http auth) wrong? Or am I doing something incorrectly? The opscenter version I'm using is 5.1.1