Difference between revisions of "REST API:tenant Resource"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
 
(20 intermediate revisions by the same user not shown)
Line 2: Line 2:
===Access Permissions===
===Access Permissions===
{{permissions|Manage Tenants and Company Capabilities|use this [[REST API]] resource.}}
{{permissions|Manage Tenants and Company Capabilities|use this [[REST API]] resource.}}


===Retrieve the metadata for a Tenant===
===Retrieve the metadata for a Tenant===
Line 18: Line 17:
         <document_space/>
         <document_space/>
         <classification/>
         <classification/>
        <partner type=""
            uri="https://{domain}/networking/rest/tenant/1384998015"
            displayValue="MSP 15">1384998015</partner>
         <trial_days/>
         <trial_days/>
         <deleted/>
         <deleted/>
         <created_id type=""  
         <created_id type=""  
             uri="https://{domain}/networking/rest/record/USER/1"  
             uri="https://{{domain}}/networking/rest/record/USER/1"  
             displayValue="">1</created_id>
             displayValue="">1</created_id>
         <owner_id type=""  
         <owner_id type=""  
             uri="https://{domain}/networking/rest/record/USER/5"  
             uri="https://{{domain}}/networking/rest/record/USER/5"  
             displayValue="Admin">5</owner_id>
             displayValue="Admin">5</owner_id>
         <modified_id type=""  
         <modified_id type=""  
             uri="https://{domain}/networking/rest/record/USER/5"  
             uri="https://{{domain}}/networking/rest/record/USER/5"  
             displayValue="Admin">5</modified_id>
             displayValue="Admin">5</modified_id>
         <number>1742261497</number>
         <number>1742261497</number>
Line 38: Line 34:
         <payment_type/>
         <payment_type/>
         <license_blocks/>
         <license_blocks/>
        <partner_id>597083057</partner_id>
         <country>United States</country>
         <country>United States</country>
         <next_billing_date/>
         <next_billing_date/>
         <base_subscriber_plan type=""  
         <base_subscriber_plan type=""  
             uri="https://{domain}/networking/rest/record/456zzy789jhk/null"  
             uri="https://{{domain}}/networking/rest/record/456zzy789jhk/null"  
             displayValue=""/>
             displayValue=""/>
         <trial_account/>
         <trial_account/>
         <accessory_purchase_plan type=""  
         <accessory_purchase_plan type=""  
             uri="https://{domain}/networking/rest/record/456zzy789jhk/null"  
             uri="https://{{domain}}/networking/rest/record/456zzy789jhk/null"  
             displayValue=""/>
             displayValue=""/>
         <workflow_owners/>
         <workflow_owners/>
Line 53: Line 48:
         <company>Greene Services</company>
         <company>Greene Services</company>
         <base_subscriber_option type=""  
         <base_subscriber_option type=""  
             uri="https://{domain}/networking/rest/record/456zzy789jhk/null"  
             uri="https://{{domain}}/networking/rest/record/456zzy789jhk/null"  
             displayValue=""/>
             displayValue=""/>
        <msp>0</msp>
         <discount/>
         <discount/>
         <workflow_state/>
         <workflow_state/>
Line 73: Line 67:
;Method:POST
;Method:POST
;URI:<tt>{{platformURL}}/rest/tenant</tt>
;URI:<tt>{{platformURL}}/rest/tenant</tt>
{{Note|If you want to create a sub-domain tenant, pass the <service_portal_sub_domain> tag in the payload. For example for a sub-domain name "mydomain", pass the tag as <service_portal_sub_domain>mydomain</service_portal_sub_domain>.}}


;Request:
;Request:
Line 86: Line 81:
         <phone>650-555-1212</phone>
         <phone>650-555-1212</phone>
         <number_of_users>1</number_of_users>
         <number_of_users>1</number_of_users>
        <estimated_number_of_users>4</estimated_number_of_users>
         <country>United States</country>
         <country>United States</country>
         <date_format>mm/dd/yyyy</date_format>
         <date_format>mm/dd/yyyy</date_format>
        <currency_format>$</currency_format>
         <time_zone>12</time_zone>
         <time_zone>12</time_zone>
         <street>1230 Midas Way</street>
         <street>1230 Midas Way</street>
Line 96: Line 89:
     </tenant>
     </tenant>
</platform>
</platform>
</syntaxhighlight>
:;Notes:
::*To create a new MSP, pass the following with the request:
:::<syntaxhighlight lang="xml" enclose="div">
<is_partner>1</is_partner>
</syntaxhighlight>
::*To create a new tenant for an MSP, pass the following with the request, where <tt>{customer_id}</tt> is the MSP's tenant ID:
:::<syntaxhighlight lang="xml" enclose="div">
<partner>{customer_id}</partner>
</syntaxhighlight>
</syntaxhighlight>


Line 117: Line 99:
::::* Whitespace between the values is ignored
::::* Whitespace between the values is ignored
::::* The values are package ''installation'' IDs -- the values that appear as the '''id''' value in the '''Installation Link''' part of the [[Package]] page.
::::* The values are package ''installation'' IDs -- the values that appear as the '''id''' value in the '''Installation Link''' part of the [[Package]] page.
::*To get the ServiceDesk application and ServiceDesk tenant capabilities, pass the following flag with the request parameters:
:::<syntaxhighlight lang="xml" enclose="div">
<isCaseDynamics>1</isCaseDynamics>
</syntaxhighlight>


;Response:
;Response:
Line 135: Line 122:
;URI:<tt>{{platformURL}}/rest/tenant?{query_parameters}</tt>
;URI:<tt>{{platformURL}}/rest/tenant?{query_parameters}</tt>
:;Sample Search:
:;Sample Search:
::<tt><nowiki>?fieldList=name,id & filter=name contains 'smith' & sortby='id'</nowiki></tt>
::<tt><nowiki>?fieldList=name,id&filter=name contains 'smith' & sortby='id'</nowiki></tt>
:: (Field names are in the [[#Fields|Fields]] section.)
:: (Field names are in the [[#Fields|Fields]] section.)


Line 196: Line 183:
|-
|-
|company|| String||  ||align="center"|[[File:Checkmark.gif|link=]]|| Company Name||   
|company|| String||  ||align="center"|[[File:Checkmark.gif|link=]]|| Company Name||   
|-
|service_portal_sub_domain|| String||  |||| Sub-domain Name|| In '''Configure Service Settings''', if '''Enable Tenant SubDomains''' is not enabled under Tenant Configuration, then even if this value is passed during tenant creation, it is not taken into consideration. For more information see, [[http://agileappscloud.info/aadev/index.php/Service_Configuration#Prefix_for_Service_Domain Prefix for Service Domain]].
|-
|-
|email|| email||  || align="center"|[[File:Checkmark.gif|link=]]|| Email address of the User ||   
|email|| email||  || align="center"|[[File:Checkmark.gif|link=]]|| Email address of the User ||   
Line 214: Line 203:
|-
|-
|document_space|| int||  ||  || per User document space||   
|document_space|| int||  ||  || per User document space||   
|-
|is_partner|| boolean||  ||  ||||Designates if the Tenant being created is an MSP or Tenant
|-
|partner|| String||  ||  || Tenant id of the MSP|| Must be set for MSP client creation
|-
|-
|object_id|| String||Read Only||  ||  tenant object id||Default:  8c5b349851c041a28d19277a12dee8f0
|object_id|| String||Read Only||  ||  tenant object id||Default:  8c5b349851c041a28d19277a12dee8f0
Line 255: Line 240:
| base_subscriber_option || Lookup || || || Tenant's payment plan || URI attribute contains record URL
| base_subscriber_option || Lookup || || || Tenant's payment plan || URI attribute contains record URL
|-
|-
| accessory_purchase_plan || Lookup || || || Tenant's plan for purchasing additional usage-resources. || URI attribute contains record URL
| accessory_purchase_plan || Lookup || || || Tenant's plan for purchasing additional usage-resources.
| URI attribute contains record URL
|}
|}
<noinclude>
<noinclude>

Latest revision as of 11:49, 1 August 2019

Performs actions on Tenant records via the REST API

Access Permissions

Lock-tiny.gif

Users that have the Manage Tenants and Company Capabilities permission can use this REST API resource. 

Retrieve the metadata for a Tenant

Retrieves metadata for a Tenant via the REST API

Method
GET
URI
https://{yourDomain}/networking/rest/tenant/{tenant_id}
Response
<syntaxhighlight lang="xml" enclose="div">

<platform>

   <tenant>
       <id>1479765335</id>
       <object_id>8c5b349851c041a28d19277a12dee8f0</object_id>
       <document_space/>
       <classification/>
       <trial_days/>
       <deleted/>
       <created_id type="" 
           uri="https://{yourDomain}/networking/rest/record/USER/1" 
           displayValue="">1</created_id>
       <owner_id type="" 
           uri="https://{yourDomain}/networking/rest/record/USER/5" 
           displayValue="Admin">5</owner_id>
       <modified_id type="" 
           uri="https://{yourDomain}/networking/rest/record/USER/5" 
           displayValue="Admin">5</modified_id>
       <number>1742261497</number>
       <name/>
       <search_string/>
       <start_date>2010-11-12T13:14:15Z</start_date>
       <payment_type/>
       <license_blocks/>
       <country>United States</country>
       <next_billing_date/>
       <base_subscriber_plan type="" 
           uri="https://{yourDomain}/networking/rest/record/456zzy789jhk/null" 
           displayValue=""/>
       <trial_account/>
       <accessory_purchase_plan type="" 
           uri="https://{yourDomain}/networking/rest/record/456zzy789jhk/null" 
           displayValue=""/>
       <workflow_owners/>
       <data_space/>
       <date_modified>2010-11-12T13:14:15Z</date_modified>
       <company>Greene Services</company>
       <base_subscriber_option type="" 
           uri="https://{yourDomain}/networking/rest/record/456zzy789jhk/null" 
           displayValue=""/>
       <discount/>
       <workflow_state/>
       <active>1</active>
   </tenant>
   <message>
       0
       <description>Success</description>
   </message>

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Create a Tenant

Creates a new Tenant

Method
POST
URI
https://{yourDomain}/networking/rest/tenant

Notepad.png

Note: If you want to create a sub-domain tenant, pass the <service_portal_sub_domain> tag in the payload. For example for a sub-domain name "mydomain", pass the tag as <service_portal_sub_domain>mydomain</service_portal_sub_domain>.

Request
<syntaxhighlight lang="xml" enclose="div">

<platform>

   <tenant>
       <company>BSmith Inc</company>
       <name>BSmith Inc</name>
       <email>bsmith@email.com</email>
       <last_name>Bob</last_name>
       <password>password</password>
       <first_name>Smith</first_name>
       <phone>650-555-1212</phone>
       <number_of_users>1</number_of_users>
       <country>United States</country>
       <date_format>mm/dd/yyyy</date_format>
       <time_zone>12</time_zone>
       <street>1230 Midas Way</street>
       <city>Sunnyvale</city>
       <force_password_to_be_changed>0</force_password_to_be_changed>
   </tenant>

</platform> </syntaxhighlight>

<syntaxhighlight lang="xml" enclose="div">

<appList>4949678694fe4ccd9dcdfd9c32c49521,

        eodf3997d57d4c7bb57f28d4e58d364f</appList> 

</syntaxhighlight>

where:
  • Whitespace between the values is ignored
  • The values are package installation IDs -- the values that appear as the id value in the Installation Link part of the Package page.
  • To get the ServiceDesk application and ServiceDesk tenant capabilities, pass the following flag with the request parameters:
<syntaxhighlight lang="xml" enclose="div">

<isCaseDynamics>1</isCaseDynamics> </syntaxhighlight>

Response
<syntaxhighlight lang="xml" enclose="div">

<platform>

   <message>
       0
       <description>Success</description>      
       <id>...</id>    
   </message>

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Search Tenants

Method
GET
URI
https://{yourDomain}/networking/rest/tenant?{query_parameters}
Sample Search
?fieldList=name,id&filter=name contains 'smith' & sortby='id'
(Field names are in the Fields section.)
Query Parameters
  • fieldList - A comma-separated list of field names to retrieve
  • The asterisk (*) wildcard specifies all fields
  • {fieldname} specifies an individual field (e.g. name)
(Use the REST API:field Resource to get a complete list of fields.)
  • For a Composite Object, specify {alias}.{fieldname} to select a related-record field, where the alias is defined in the Object Relationships.
  • For a Database View, specify {alias}.{fieldname}, where the object alias is defined in the Database View.
  • alias.* specifies all fields in the aliased object.
  • filter - Filtering criteria to filter the records
  • pageSize - Number of records to retrieve from the result set in order to make a "page".
  • page - Number of the logical page in a database result set. The first page is page "zero" (0).
Page zero is returned by default, so appending &pageSize=1 to your query returns a single record.
  • getTotalRecordCount returns the number of total records.
    Causes the following structure to be returned, where N is the total number of records:
<syntaxhighlight lang="xml" enclose="div">

<platform>

  <status>
  <packageDeploy>
  ...
  </packageDeploy>
  </status>
  <message>
     0
     <description>Success</description>
  </message>
  <totalRecordCount>N</totalRecordCount> 

</platform> </syntaxhighlight>

  • sortBy - Field name for primary sort
    Ex: &sortBy=name
  • sortOrder - Sort order of the primary field, either asc or desc (ascending or descending)
    Ex: &sortOrder=desc
  • sortBy2 - Field name for secondary sort
  • sortOrder2 - Sort order of the second field, either asc or desc (ascending or descending)
For more information, see: Specifying Query Parameters in REST APIs

Update a Tenant

Updates Tenant information

Method
PUT
URI
https://{yourDomain}/networking/rest/tenant/{tenant_id}
Request
<syntaxhighlight lang="xml" enclose="div">

<platform> <tenant>

   <free>1</free>
   <country>India</country>
   <payment_type>Manual</payment_type>

</tenant> </platform> </syntaxhighlight>

Response

<syntaxhighlight lang="xml" enclose="div"> <platform>

   <message>
       0
       <description>Success</description>        
   </message>

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Delete a Tenant

Deletes a Tenant, and all related information

Method
DELETE
URI
https://{yourDomain}/networking/rest/tenant/{tenant_id}
Response
<syntaxhighlight lang="xml" enclose="div">

<platform>

   <message>
       0
       <description>Success</description>        
   </message>

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Fields

Name Type Attributes Required During Add Description Additional Information
company String Checkmark.gif Company Name
service_portal_sub_domain String Sub-domain Name In Configure Service Settings, if Enable Tenant SubDomains is not enabled under Tenant Configuration, then even if this value is passed during tenant creation, it is not taken into consideration. For more information see, [Prefix for Service Domain].
email email Checkmark.gif Email address of the User
first_name String Checkmark.gif User First Name
last_name String Checkmark.gif User Last Name
password String Checkmark.gif Password
time_zone int Checkmark.gif Time zone ID Time Zone Codes
date_format String Date Format
phone String Checkmark.gif User Phone
number_of_users int Number Of Users
document_space int per User document space
object_id String Read Only tenant object id Default: 8c5b349851c041a28d19277a12dee8f0
number int Read Only Tenant Number
deleted Boolean Read Only Designates if the Tenant is active or not
discount percentage Discount for the tenant
created_id String Read Only
data_space int per user data space
classification String Customer classification
owner_id String Read Only
start_date date Read Only registration date UTC Format
country String Checkmark.gif
city String Checkmark.gif
state String
sendWelcomeEmail Boolean Sends a welcome email when set to 1 Default: 0
force_password_change_on_login Boolean Prompts for password reset on first login when set to 1 Default: 1
street String Checkmark.gif
zip String Checkmark.gif
base_subscriber_plan Lookup Tenant's purchase plan URI attribute contains record URL
base_subscriber_option Lookup Tenant's payment plan URI attribute contains record URL
accessory_purchase_plan Lookup Tenant's plan for purchasing additional usage-resources. URI attribute contains record URL