Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please expose REST api #430

Open
magnusarinell opened this issue Dec 16, 2020 · 1 comment
Open

Please expose REST api #430

magnusarinell opened this issue Dec 16, 2020 · 1 comment

Comments

@magnusarinell
Copy link

Hi,

I want to use redis-commander for running FLUSHALL from my web application. So I have redis-commander in my Docker stack running under the pathprefix /redis-commander and it seems I can do a POST to /redis-commander/apiv2/exec/<my instance> but I'm not sure this is the way to go about.

Also it would be nice to be able to set CORS on this API so that I can access the API from my development server.

Cheers!

@sseide
Copy link
Collaborator

sseide commented Dec 18, 2020

Hi,

currently you have to make two calls to get the result you want. First log in and get the queryToken, second call is the .../exec/... one you already found. The queryToken has to be added to the body or url as param redisCommanderQueryToken or added as Authorization: Bearer ... HTTP header.

$ curl -X POST -d 'username=myuser&password=mypass' http://localhost:8081/redis-commander/signin
{"ok":true,"bearerToken":"eyJh...","queryToken":"eyJhb..."}

$ curl -i -X POST -d 'cmd=FLUSHALL&redisCommanderQueryToken=eyJhb...' http://localhost:8081/redis-commander/api/v2/exec/R:192.168.1.41:6379:1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants