NginxProxyManager / nginx-proxy-manager

Docker container for managing Nginx proxy hosts with a simple, powerful interface
https://nginxproxymanager.com
MIT License
22.29k stars 2.58k forks source link

Documentation for API? #341

Open ghost opened 4 years ago

ghost commented 4 years ago

Hello, I see there is some kind of API at "/api" , please is there any documentation for it? I would like to incorporate nginx-proxy-manager into a development tool with automated hosts created. Thanks!

FantaBlueMystery commented 4 years ago

Yes and please add to api "get certificate", we use the 'lets encrypt' certificate for email server. If we can cronjob the certificate with Curl + Shell for email servers, that would be very helpful.

chaptergy commented 3 years ago

There is the json schema which is used for validation, so it should always be up to date, but it is a little more complicated to extract the information about an endpoint. I have created a gist which collects all json schema files in a single file, which makes it a little easier to find stuff. Just search for the string links, and you should be able to find information on the endpoints as children of each links item.

But I've always found it easiest to open the developer console in my browser and switch to the network tab in there. Then I can just execute what I want to do in the frontend, and see exactly what request was send with what data to the backend, so I can replicate the behaviour.

(You can also find a swagger schema in this repo which you can then view e.g. with editor.swagger.io. But I think this schema has nothing to do with the actual API, at least it seems so.)

haydenseitz commented 2 years ago

Thoughts on re-opening? From the other duplicate issues, it seems there is demand. Implementing swagger UI or similar API docs tool into this project would be very useful for development and integration into other tools. Adding non-user API tokens as suggested here https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1619 would also be nice. I'd love to hook this up to an ansible playbook to automate adding new proxy hosts

setswei commented 2 years ago

I would also like to see this re-opened. i am working on ansible playbooks to maintain state and execute particular automation workflows that i would like NPM to be a part of.

chaptergy commented 2 years ago

Sure, I could reopen it though I doubt this ever gets resolved. As https://github.com/NginxProxyManager/nginx-proxy-manager/discussions/1202 describes, the focus is currently mainly on v3, which has a new approach (or has one at all lol) to the documentation and testing of the API, so it should always be well documented. Creating a documentation for v2 would mean a huge amount of work for a product which will be obsolete hopefully soonish. For now you'll have to make do with what I suggested above.

setswei commented 2 years ago

Apologizes @chaptergy, i was not aware version 3 was in the works. Are there plans to allow API access in the new version and if so i am happy to wait and not spend time on version 2 ?

kennylajara commented 2 years ago

@chaptergy Is this the project for Version 3 been updated? Is it updated? I see the last update is from 2019

m-chingis commented 2 years ago

I agree with the above commentators on reopening this issue, having API for CLI will be a good complement to this excellent GUI tool.

laopaoer-wallet commented 1 year ago

Looking forward to this feature, because it is necessary to integrate other systems

webysther commented 1 year ago

For who maybe only want to start with, save the api.swagger.json and import in Postman as a collection, for who is hurry:

image

Nginx Proxy Manager API.postman_collection.json.zip

After only request the token as explained here.

Tip: if you creat a postman collection, you can import in hoppscotch and run without expose the API.

github-actions[bot] commented 6 months ago

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