The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

C# json api 1 problem

Discussion in 'cPanel Developers' started by batoo, Dec 27, 2013.

  1. batoo

    batoo Member

    Joined:
    May 1, 2013
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    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=mymail@gmail.com&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?
     
    #1 batoo, Dec 27, 2013
    Last edited: Dec 27, 2013
  2. batoo

    batoo Member

    Joined:
    May 1, 2013
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    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..
     
  3. cPAndrewHodge

    cPAndrewHodge cPanel UI Developer
    Staff Member

    Joined:
    Dec 10, 2012
    Messages:
    52
    Likes Received:
    3
    Trophy Points:
    8
    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
     
Loading...

Share This Page