thelastpickle / cassandra-reaper

Automated Repair Awesomeness for Apache Cassandra
http://cassandra-reaper.io/
Apache License 2.0
490 stars 218 forks source link

Need REST API #1278

Closed mkray1 closed 1 year ago

mkray1 commented 1 year ago

Spotted on 3.2.1 (dbf74da) Hi There,

I am working on automating repairs I just wanted to have the API for cluster. I tried with

curl -u xxx:xxx -i -X POST http://hvidltspdb35:8080/login -d username='xxx' -d password='xxx' to get the sessionid but when I tried to get GET/cluster. Its not working. Can anyone please help me on this.

curl -X -v GET -H 'JSESSIONID=node0pj1gh7psal2v.node0' 'http://hvidltspdb35:8080/cluster'

"Forbidden access. Please login to access this page."

jdonenine commented 1 year ago

You'll want to make a series of authentication requests to get the right token for subsequent calls to other APIs.

Take a look at http://cassandra-reaper.io/docs/api/

You'll first want to perform a POST /login like you mention, then you'll use the session ID and other headers to perform a GET /jwt.

That ultimately resulting JWT is what you really want for subsequent requests to other APIs.

You'll use that JWT as the bearer token for all subsequent requests.

Hopefully that helps.

Miles-Garnsey commented 1 year ago

Hi @mkray1, did Jeff's suggestion fix your problem? Can we close this ticket?

adejanovski commented 1 year ago

I'll close this ticket. Feel free to re-open if you're still experiencing this issue.