null response after creating domain from another server

ghesi

New Member
Nov 15, 2021
5
0
1
43
Hi,

Im working to create a plugin for cpanel to auto add domains to PMG and I have this dilema, is normal that the response for POST /api2/json//config/domains to be "{"data":null}", even if the POST is successful.

Code:
[root@master proxmox]# curl -v -b "$(</tmp/cookie_PMG)" -H "$(</tmp/csrftoken_PMG)" -d "domain=text22.ro&comment=un comentariu" -X POST https://pmg.host.net:8006/api2/json/config/domains
* About to connect() to pmg.host.net port 8006 (#0)
*   Trying 185.45.284.231...
* Connected to pmg.host.net (185.45.284.231) port 8006 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* SSL connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate:
*       subject: CN=pmg.host.net
*       start date: Nov 12 17:05:22 2021 GMT
*       expire date: Feb 10 17:05:21 2022 GMT
*       common name: pmg.host.net
*       issuer: CN=R3,O=Let's Encrypt,C=US
> POST /api2/json/config/domains HTTP/1.1
> User-Agent: curl/7.29.0
> Host: pmg.host.net:8006
> Accept: */*
> Cookie: PMGAuthCookie=PMG:root@pam:634261E::qaCOcYpfiiY++xxe+gsfeYkW8oKmOLPBh3427pi7+g3gVoVwH9sezvmzH9Rl1TNPkrNZee2EEUf0nqesnrRkQDPm4RUBKHwqoxt9pGYyxyLtzkKjDxFS2VI0OWvoxY8zdVHj84JVoCK/j2yZU1+8JHuLZzk0QVscSpBXdaSFqjKfYoB9E1BtB8i5ArVP/5lhdc9YJT8uBq4u8Dyba0sOvVvncoOj98BF7a0TNhM2f9aac4IPkbTqAiqUhvyAHlbemF5LKAc1AWuw7ghMfyIQ5Mq4q5eBo6ih0w9Os1oBY1qwy+0ML7g0JrTwpWyBkyFJf3NtYuiO8G4b7+zGc9YQw==
> CSRFPreventionToken:6194561E:flnjWvhqbJAHsggvOoVGHoNkkK3TY3E2Nux9a9NXqkc
> Content-Length: 38
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 38 out of 38 bytes
< HTTP/1.1 200 OK
< Cache-Control: max-age=0
< Connection: close
< Connection: Keep-Alive
< Date: Sat, 20 Nov 2021 17:47:10 GMT
< Pragma: no-cache
< Server: pve-api-daemon/3.0
< Content-Length: 13
< Content-Type: application/json;charset=UTF-8
< Expires: Sat, 20 Nov 2021 17:47:10 GMT
<
* Closing connection 0
{"data":null}[root@master proxmox]#

On the api page https://pmg.proxmox.com/pmg-docs/api-viewer/index.html#/config/domains I see that the command returns null. So... is normal or I dome something wrong?
 
Last edited:
Yes, the domain is added and I dont understand if is normal for the data:null response.
 
as said - it looks ok to me - the request that are marked to return 'null' will do so like this.

I hope this explains it
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!