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

Added postman collection for backend API

Open dnviti opened this issue 1 year ago • 4 comments

dnviti avatar Apr 27 '24 15:04 dnviti

Hey there,

I was able to import this collection into Postman (in a bit of a roundabout way) and tried to create a host, but it appears the payload sent in the body doesn't match what is sent when it's done via the GUI.

Body payload in the collection:

{
    "domain_names": [],
    "forward_scheme": "",
    "forward_host": "",
    "forward_port": "",
    "certificate_id": "",
    "ssl_forced": true,
    "hsts_enabled": true,
    "hsts_subdomains": true,
    "http2_support": true,
    "block_exploits": true,
    "caching_enabled": true,
    "allow_websocket_upgrade": true,
    "access_list_id": 0,
    "advanced_config": "",
    "enables": true,
    "meta": "",
    "locations": ""
}

Working payload taken from the request in the GUI (and reproduced in Postman); this was using a cert created from Cloudflare, rather than Let's Encrypt:

{
  "domain_names": [
    "subdomain.domain.com"
  ],
  "forward_scheme": "http/https",
  "forward_host": "",
  "forward_port": #,
  "access_list_id": "0",
  "certificate_id": #,
  "meta": {
    "letsencrypt_agree": false,
    "dns_challenge": false
  },
  "advanced_config": "",
  "locations": [],
  "block_exploits": false,
  "caching_enabled": false,
  "allow_websocket_upgrade": false,
  "http2_support": false,
  "hsts_enabled": false,
  "hsts_subdomains": false,
  "ssl_forced": false
}

Using the original payload returns a 400 "internal error" (which is not terribly useful in troubleshooting :) )

image

Doing some quick testing and trying to match the 1st to 2nd body, I think I discovered the error: "enables" should be "enabled". Even matching the body almost exactly would then return a "400 data should NOT have additional properties" error:

image

Changed the s to a and it worked!

image

Also need to mention that the domain_names field requires "" around the subdomain, otherwise the same Internal Server Error error is returned:

"domain_names": ["subdomain.domain.com"]

kmanwar89 avatar May 13 '24 01:05 kmanwar89

On the develop branch, and in the next release, there's a full OpenAPI schema available on the /api/schema endpoint. That should be importable into Postman and others.

jc21 avatar Oct 11 '24 04:10 jc21

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

github-actions[bot] avatar May 22 '25 02:05 github-actions[bot]

Docker Image for build 6 is available on DockerHub:

nginxproxymanager/nginx-proxy-manager-dev:pr-3726

[!NOTE] Ensure you backup your NPM instance before testing this image! Especially if there are database changes. This is a different docker image namespace than the official image.

[!WARNING] Changes and additions to DNS Providers require verification by at least 2 members of the community!