Manage Tenant Print

  • 1050

TENANT

  1. Creating New Tenant

    [[API:Function]] – goAddMultiTenant

    • This application is used to create new tenant . Newly created tenant belongs to user that authenticated a request.

    Mandatory parameters from “postfields variables:

    • goUser- Username. String

    • goPass- Password. String

    • goAction- Action performed by the [[API:Functions]]. String

    • tenant_id – tenant id. Integer

    • tenant_name – name of tenant. String

    • admin – name for admin. String

    • pass – password for admin. String

    • active – status of tenant, values is only Y or N. String

     

     

    Returns:

     

    result “success” means that tenant has been created. String

     

     

    result – “error” means that tenant has not been created, containing the error occurred. String

    • Error: Set a value for Tenant ID.

    • Error: Set a value for Tenant name.

    • Error: Default value for active is Y or N only.

    • Error: Default value for access_call_times is Y or N only.

    • Error: Default value for access_carriers is Y or N only.

    • Error: Default value for access_voicemails is Y or N only.

    • Error: Special characters found in tenant_id

    • Error: Special characters found in tenant_name

    • Error: Special characters found in admin

    • Error: Special characters found in pass

    • Error: Tenant ID already exist

    • Error: Failed to add Tenant.


    tenant_id – created tenant id. Integer

     

    Sample Code:

     

    <?php

    $url = "https://jameshv.goautodial.com/goAPI/goMultiTenant/goAPI.php"; # URL to GoAutoDial API file

    $postfields["goUser"] = ""; #Username goes here. (required)

    $postfields["goPass"] = ""; #Password goes here. (required)

    $postfields["goAction"] = ""; #action performed by the [[API:Functions]]

    $postfields["responsetype"] = "json"; #json. (required)

    $postfields["hostname"] = $_SERVER['REMOTE_ADDR']; #Default value

    $postfields["tenant_id"] = ""; #Desired tenant ID (required)

    $postfields["tenant_name"] = ""; #Desired name (required)

    $postfields["admin"] = ""; #Desired admin (required)

    $postfields["pass"] = ""; #Desired pass (required)

    $postfields["active"] = ""; #Y or N (required)

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $url);

    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

    curl_setopt($ch, CURLOPT_POST, 1);

    curl_setopt($ch, CURLOPT_TIMEOUT, 100);

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);

    $data = curl_exec($ch);

    curl_close($ch);

    $output = json_decode($data);

     

    // print_r($data);

     

    if ($output->result=="success") {

    # Result was OK!

    echo "Added New Tenant ID";

    } else {

    # An error occured

    echo $output->result;

    }

    ?>

  2. Updating Tenant

    [[API:Function]] – goEditMultiTenant

    • This application is used to update a tenant. Only tenant that belongs to authenticated user can be updated.

     

    Mandatory parameters from “postfields variables:

    • goUser- Username. String

    • goPass- Password. String

    • goAction- Action performed by the [[API:Functions]]. String

    • tenant_id – tenant id. Integer

     

    Returns:

    result – “success” means that tenant has been updated successfully. String

     

    result – “error” means that tenant has not been updated, containing the error occurred. String

    • Error: Set a value for Tenant ID.

    • Error: Set a value for Tenant name.

    • Error: Default value for active is Y or N only.

    • Error: Default value for access_call_times is Y or N only.

    • Error: Default value for access_carriers is Y or N only.

    • Error: Default value for access_voicemails is Y or N only.

    • Error: Special characters found in tenant_id

    • Error: Special characters found in tenant_name

    • Error: Special characters found in admin

    • Error: Special characters found in pass

    • Error: Tenant doesn't exist

     

    tenant_id – updated tenant id. Integer

     

    Sample Code:

     

    <?php

    $url = "https://jameshv.goautodial.com/goAPI/goMultiTenant/goAPI.php"; # URL to GoAutoDial API file

    $postfields["goUser"] = ""; #Username goes here. (required)

    $postfields["goPass"] = ""; #Password goes here. (required)

    $postfields["goAction"] = ""; #action performed by the [[API:Functions]]

    $postfields["responsetype"] = "json"; #json. (required)

    $postfields["hostname"] = $_SERVER['REMOTE_ADDR']; #Default value

    $postfields["tenant_id"] = ""; #Desired tenant ID (required)

    $postfields["tenant_name"] = ""; #Desired name (required)

    $postfields["admin"] = ""; #Desired admin (required)

    $postfields["active"] = ""; #Y or N (required)

     

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $url);

    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

    curl_setopt($ch, CURLOPT_POST, 1);

    curl_setopt($ch, CURLOPT_TIMEOUT, 100);

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);

    $data = curl_exec($ch);

    curl_close($ch);

    $output = json_decode($data);

     

    // print_r($data);

     

    if ($output->result=="success") {

    # Result was OK!

    echo "Update Success";

    } else {

    # An error occured

    echo $output->result;

    }

    ?>


  3. Deleting Tenant

    [[API:Function]] – goDeleteMultiTenant

    • This application is used to delete a tenant. Only tenant that belongs to authenticated user can be delete.

     

    Mandatory parameters from “postfields variables:

    • goUser- Username. String

    • goPass- Password. String

    • goAction- Action performed by the [[API:Functions]]. String

    • tenant_id – tenant id. Integer

     

    Returns:

    result – “success” means that tenant has been deleted successfully. String

     

    result – “error” means that tenant has not been deleted, containing the error occurred. String

    • Error: Set a value for tenant ID.

    • Error: Tenant doesn't exist.

     

    tenant_id – deleted tenant id. Integer


    Sample Code:

     

    <?php

    $url = "https://YOUR_URL/goAPI/goMultiTenant/goAPI.php"; #URL to GoAutoDial API. (required)

    $postfields["goUser"] = ""; #Username goes here. (required)

    $postfields["goPass"] = ""; #Password goes here. (required)

    $postfields["goAction"] = ""; #action performed by the [[API:Functions]]. (required)

    $postfields["responsetype"] = "json"; #json. (required)

    $postfields["tenant_id"] = ""; #Desired Tenant ID. (required)

    $postfields["hostname"] = $_SERVER['REMOTE_ADDR']; #Default value

     

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $url);

    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

    curl_setopt($ch, CURLOPT_POST, 1);

    curl_setopt($ch, CURLOPT_TIMEOUT, 100);

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);

    $data = curl_exec($ch);

    curl_close($ch);

    $output = json_decode($data);

     

    // print_r($data);

     

    if ($output->result=="success") {

    # Result was OK!

    echo "Tenant deleted successfully";

    } else {

    # An error occured

    echo $output->result;

    }

    ?>


  4. Displaying Tenant

    [[API:Function]] – goGetMultiTenantList

    • This application is used to get list of tenant belongs to user.

     

    Mandatory parameters from “postfields variables:

    • goUser- Username. String

    • goPass- Password. String

    • goAction- Action performed by the [[API:Functions]]. String

     

    Returns:

    result – “success” means that query was successful. String

     

    result – “error” means that query was not successful. , containing the error occurred. String

     

    tenant_id – tenant id. Integer

    tenant_name – name of tenant. String

    active – status of tenant. String

     

    Sample Code:

     

    <?php

    $url = "https://YOUR_URL/goAPI/goMultiTenant/goAPI.php"; #URL to GoAutoDial API. (required)

    $postfields["goUser"] = ""; #Username goes here. (required)

    $postfields["goPass"] = ""; #Password goes here. (required)

    $postfields["goAction"] = ""; #action performed by the [[API:Functions]]. (required)

    $postfields["responsetype"] = "json"; #json. (required)

     

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $url);

    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

    curl_setopt($ch, CURLOPT_POST, 1);

    curl_setopt($ch, CURLOPT_TIMEOUT, 100);

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);

    $data = curl_exec($ch);

    curl_close($ch);

    $output = json_decode($data);

     

    if ($output->result=="success") {

    # Result was OK!

    for($i=0;$i<count($output->tenant_id);$i++){

    echo $output->tenant_id[$i]."</br>";

    echo $output->tenant_name[$i]."</br>";

    echo $output->cnt[$i]."</br>";

    echo $output->active[$i]."</br>";

    }

    } else {

    # An error occured

    echo "The following error occured: ".$results["message"];

    }

     ?>


  5. Displaying Tenant Information

    [[API:Function]] – goGetMultiTenantInfo

    • Allows to retrieve some attributes of a given tenant. tenant should belong to the user that authenticated the request.

     

    Mandatory parameters from “postfields variables:

    • goUser- Username. String

    • goPass- Password. String

    • goAction- Action performed by the [[API:Functions]]. String

    • tenant_id – tenant id. Integer

     

     Returns:

    result – “success” means that query was successful. String

     

    result – “error” means that query was not successful. , containing the error occurred. String

    • Error: Set a value for tenant ID.

    • Error: tenant doesn't exist.

     

    tenant_id – tenant id. Integer

    tenant_name – name of tenant. String

    active – status of tenant. String

     

    Sample Code:

     

    <?php

    $url = "https://YOUR_URL/goAPI/goMultiTenant/goAPI.php"; #URL to GoAutoDial API. (required)

    $postfields["goUser"] = ""; #Username goes here. (required)

    $postfields["goPass"] = ""; #Password goes here. (required)

    $postfields["goAction"] = ""; #action performed by the [[API:Functions]]. (required)

    $postfields["responsetype"] = "json"; #json. (required)

    $postfields["tenant_id"] = ""; #Desired Tenant ID. (required)

     

     $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $url);

    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

    curl_setopt($ch, CURLOPT_POST, 1);

    curl_setopt($ch, CURLOPT_TIMEOUT, 100);

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);

    $data = curl_exec($ch);

    curl_close($ch);

    $output = json_decode($data);

     

    // print_r($data);

     

    if ($output->result=="success") {

    # Result was OK!

    for($i=0;$i<count($output->tenant_id);$i++){

    echo $output->tenant_id[$i]."</br>";

    echo $output->tenant_name[$i]."</br>";

    echo $output->cnt[$i]."</br>";

    echo $output->active[$i]."</br>";

    }

    } else {

    # An error occured

    echo $output->result;

    }

     ?>


[[API:Function]] – goAddMultiTenantThis application is used to create new tenant . Newly created tenant  belongs to user that authenticated a request.
Mandatory parameters from “postfields” variables:goUser- Username.  StringgoPass-  Password.  StringgoAction-  Action performed by the [[API:Functions]].  Stringtenant_id – tenant id. Integertenant_name – name of tenant. Stringadmin – name for admin. Stringpass – password for admin. Stringactive – status of tenant, values is only Y or N. String

Returns:result – “success” means that tenant has been created.  String
result – “error” means that tenant has not been created, containing the error occurred. StringError: Set a value for Tenant ID.Error: Set a value for Tenant name.Error: Default value for active is Y or N only.Error: Default value for access_call_times is Y or N only.Error: Default value for access_carriers is Y or N only.Error: Default value for access_voicemails is Y or N only.Error: Special characters found in tenant_idError: Special characters found in tenant_nameError: Special characters found in adminError: Special characters found in passError: Tenant ID already existError: Failed to add Tenant.
tenant_id – created tenant id. Integer
Sample Code:
<?php         $url = "https://jameshv.goautodial.com/goAPI/goMultiTenant/goAPI.php"; # URL to GoAutoDial API file         $postfields["goUser"] = ""; #Username goes here. (required)         $postfields["goPass"] = ""; #Password goes here. (required)         $postfields["goAction"] = ""; #action performed by the [[API:Functions]]         $postfields["responsetype"] = "json"; #json. (required)         $postfields["hostname"] = $_SERVER['REMOTE_ADDR']; #Default value         $postfields["tenant_id"] = ""; #Desired tenant ID (required)         $postfields["tenant_name"] = ""; #Desired name (required)         $postfields["admin"] = ""; #Desired admin (required)         $postfields["pass"] = ""; #Desired pass (required)         $postfields["active"] = ""; #Y or N (required)

         $ch = curl_init();         curl_setopt($ch, CURLOPT_URL, $url);         curl_setopt($ch, CURLOPT_HTTPHEADER, $header);         curl_setopt($ch, CURLOPT_POST, 1);         curl_setopt($ch, CURLOPT_TIMEOUT, 100);         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);         curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);         $data = curl_exec($ch);         curl_close($ch);         $output = json_decode($data);
//      print_r($data);
        if ($output->result=="success") {           # Result was OK!                echo "Added New Tenant ID";         } else {           # An error occured                echo $output->result;        }?>

Was this answer helpful?

« Back