Connection from integromat to cpanel API with API Tokens

Ram Freedman

Member
Jul 18, 2017
19
0
1
Israel
cPanel Access Level
Website Owner
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,491
1,008
313
cPanel Access Level
Root Administrator
Hey there! While I can't comment on the site code, can you try running this manually like the example from the docs page to see if that works?

curl -H'Authorization: cpanel username:APITOKEN' 'https://example.com:2083/execute/Module/function?parameter=value'

If you are logged in to cPanel you can also try adjusting the URL directly in your browser session to ensure that executes the correct operation.
 

Ram Freedman

Member
Jul 18, 2017
19
0
1
Israel
cPanel Access Level
Website Owner
Hi @cPRex,
Thanks for your reply.

Sadly I don't know how to run the curl command directly.
Should I use it with CMD and just add the command?

The username:APITOKEN should be username:APITOKEN or my Cpanel username:APITOKEN ?

When I'm already logged in to my cpanel I can run the command directly from the web browser without using APITOKEN without a problem problem:

1625591370298.png
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,491
1,008
313
cPanel Access Level
Root Administrator
Great - so at least that indicates the command is working well.

Your user may not have command line access, so you may not have that option on your side.

It would be the cPanel username of your account, which looks like it could be "shira" from the output you provided.
 

Ram Freedman

Member
Jul 18, 2017
19
0
1
Israel
cPanel Access Level
Website Owner
Yes - the command is working well when using it via the browser and while logged in to cpanel.
The problem is when I'm trying to use the API with APITOKEN via integromat.

I tried using a online curl tool like that Run Curl Commands Online and I get the same problem:

1625597183046.png

Also when running it I'm getting this error:

1625597238513.png

Any I deas?
Thanks!
 

Ram Freedman

Member
Jul 18, 2017
19
0
1
Israel
cPanel Access Level
Website Owner

Ram Freedman

Member
Jul 18, 2017
19
0
1
Israel
cPanel Access Level
Website Owner
In integromat I can send HTTP requests and select:
The URL, Method (GET / POST etc.), Headers, Query String, Body type (application/x-www-form-urlencoded or RAW or multipart/form-data) and the Fields of the body.

Any I dea how can I convert the CURL command to each part?

Thanks!!
 

Ram Freedman

Member
Jul 18, 2017
19
0
1
Israel
cPanel Access Level
Website Owner
Dear @cPRex
Thanks for your help.
The solution was to add everything as one value in the header instead of 2.
So instead of having Authorization: cpanel and another one of username:token
I used:
Authorization in the Value field and cpanel username:token in the Name filed.

Now it's working.

Thanks for your help!

1625731888449.png