batoo

Member
May 1, 2013
7
0
1
cPanel Access Level
Root Administrator
Hello,

I tried to develop generic function to call API 1 and API 2 functions.

What i tested is:

1. API 1 without parameters = success
2. API 1 with parameters = fail
3. API 2 without parameters = success
4. API 2 with parameters = success

I don`t know why i cant post parameters with API 1 function.


Here is an example:

Request Url: https://myhostname:2083/json-api/cp...emopass&[email protected]&port=21&rdir=/

Also i try it with encoded query strings, but same problem.


This web request have POST method and Basic Authentication with username and pass as cpanel account.


Example response:

{"apiversion":"1","type":"event","module":"Fileman","func":"fullbackup","source":"module","data":{"result":""},"event":{"result":1}}



I dont know why only API 1 with query string parameters don`t work, if i call some API 2 function on same way even with query string parameters, everything works fine.

Do i miss some difference between API 1 and API 2?
 
Last edited:

batoo

Member
May 1, 2013
7
0
1
cPanel Access Level
Root Administrator
I found my problem.

API1: arg (string) — List of arguments. These variables are numbered such that the first is arg-0, the second is arg-1, and so on.
Example: arg-0=username&arg-1=somepass

But how do i know witch parameter if first. second etc..
 

AndrewH.

Well-Known Member
Dec 10, 2012
52
3
83
cPanel Access Level
Root Administrator
API2 (and UAPI) are written to be much friendlier to call and unfortunately since we are aiming towards replacing API1 calls with UAPI calls we haven't gone back and put in work into making the API1 system more user friendly.


That said, here is a link to all the supported API1 calls and in each page it has the order of parameters (search for "Syntax").

API1 Module Listing