nginx-proxy-manager icon indicating copy to clipboard operation
nginx-proxy-manager copied to clipboard

API Support

Open danielpmc opened this issue 3 years ago • 6 comments
trafficstars

Is your feature request related to a problem? Please describe. No

Describe the solution you'd like A way to create API tokens that are perm. I have been making a js API for nginx proxy manager. Its all going good and works but having to use the user token that resets every 24 - 48hours.

Describe alternatives you've considered None at the moment. Token automatically resets every 24 - 48hours. Only way i can see around this for now is to automatically login and fetch the new token

danielpmc avatar Nov 30 '21 18:11 danielpmc

You can api post the logins to get a new token, if you post {secret and identity} to ...api/tokens it'll return a new token

I added it as part of my script

BUT api keys would be cool too

Festeazy avatar Dec 06 '21 18:12 Festeazy

Do anyone have an example on this matter/issue ? Like lets say i have the npm running locally on my machine and just then i wanna make a local call to the npm to change a proxy and stuff.

crazyaccess avatar Dec 17 '21 04:12 crazyaccess

Do anyone have an example on this matter/issue ? Like lets say i have the npm running locally on my machine and just then i wanna make a local call to the npm to change a proxy and stuff.

Not sure if you're monitoring this issue still, but I'd be happy to show you how the API can be used. I'm working on expanding the documentation on it, since the developer hasn't responded to the multiple issue requests for API documentation.

I'm not a web developer, however, so it may be a slow venture..

kmanwar89 avatar Sep 04 '22 22:09 kmanwar89

Do anyone have an example on this matter/issue ? Like lets say i have the npm running locally on my machine and just then i wanna make a local call to the npm to change a proxy and stuff.

Not sure if you're monitoring this issue still, but I'd be happy to show you how the API can be used. I'm working on expanding the documentation on it, since the developer hasn't responded to the multiple issue requests for API documentation.

I'm not a web developer, however, so it may be a slow venture..

Thats great! if you started something you can share it with the contributors...

suparagroup avatar Sep 10 '22 01:09 suparagroup

I did manage to get this working. but API tokens are temp. so i must fetch a new one every x hours to make sure it stays updated. Would be nice to have a perm API key that could be generated once logged in, maybe under the user section. I'd be happy helping with API Docs too. as iv played a ton with NPM and know a lot about how to use the API :)

danielpmc avatar Sep 10 '22 02:09 danielpmc

Do anyone have an example on this matter/issue ? Like lets say i have the npm running locally on my machine and just then i wanna make a local call to the npm to change a proxy and stuff.

Not sure if you're monitoring this issue still, but I'd be happy to show you how the API can be used. I'm working on expanding the documentation on it, since the developer hasn't responded to the multiple issue requests for API documentation. I'm not a web developer, however, so it may be a slow venture..

Thats great! if you started something you can share it with the contributors...

I've never submitted a PR, so I may do that, but the gist of it is this (I use ThunderClient within Visual Studio Code instead of Postman). At this point, really what I've discovered is just:

  1. Using basic auth, send a GET to <npm server IP>/api/tokens to get a Bearer Auth token
  2. Using the token in the next request, perform whatever commands you want to do

Unfortunately, not all functions are documented - for instance, once you click on a host and want to, say, modify some advanced settings, I don't see anywhere in the API docs where that endpoint is exposed. If I find time, I may end up reading through the source code and figuring it out myself, but I see the author (@jc21) is still active/contributing to other projects. Perhaps they can chime in and help us along in this endeavour?

kmanwar89 avatar Sep 11 '22 16:09 kmanwar89

any update?

hexaaagon avatar Apr 10 '23 14:04 hexaaagon

any update?

Assuming this is directed at me - afraid not, life got in the way as it always does :) No promises to make here - maybe one day myself or someone else will get around to documenting it. Hopefully the author of the program does it before the community does!

kmanwar89 avatar May 23 '23 00:05 kmanwar89

Issue is now considered stale. If you want to keep it open, please comment :+1:

github-actions[bot] avatar Mar 01 '24 01:03 github-actions[bot]