Need help with cPanel API 2 authentication
Hi there,
My provider uses cPanel and I am trying to use the api to create a TXT record in my DNS zone.
I created an API key, and use this page to see which call I need to do:
I keep getting "access denied". I tried port 2083. I tried to move the user and key to an authentication header. Nothing helps... What am I doing wrong? The documentation isn't very clear if it should be a GET or POST request. But I tried both in Postman.
I keep getting "access denied". I tried port 2083. I tried to move the user and key to an authentication header. Nothing helps... What am I doing wrong? The documentation isn't very clear if it should be a GET or POST request. But I tried both in Postman.
-
Hey there! I did a lot of testing with this tonight, and got some confusing results. I'm leaving this open and I hope to get some more details tomorrow. 0 -
I finally got it working :cool: GET or POST does not matter. Both work. Port number is 2083 You have to use your username and password in the header as basic authorization: Creating the TXT record: curl --location --request POST \ 'https://papasmurf.nl:2083/json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=ZoneEdit&cpanel_jsonapi_func=add_zone_record&domain=papasmurf.nl&name=_acme-challenge&type=TXT&txtdata=blahblah&class=IN&ttl=3600' \ --header 'Authorization: Basic '0 -
I'm glad you were able to get that working. My testing was also working well on port 2083 last night, but not 2087. I'm still going to look into that and see if that is something that should be updated in our docs. 0 -
I spoke with one of the devs today and they couldn't reproduce the odd behavior I was seeing last night on my end, so it seems there may have been an issue with my testing environment itself. I'm glad you got this working, but please reach out if you need anything else. 0
Please sign in to leave a comment.
Comments
4 comments