Difference between revisions of "REST API:tenant Resource"

From LongJump Support Wiki
imported>Aeric
 
imported>Aeric
 
(5 intermediate revisions by the same user not shown)
Line 7: Line 7:
Retrieves metadata for a Tenant via the [[REST API]]
Retrieves metadata for a Tenant via the [[REST API]]
;Method:GET
;Method:GET
;URI:<tt><nowiki>https://{domain}/networking/rest/tenant/{tenant_id}</nowiki></tt>
;URI:<tt>{{platformURL}}/rest/tenant/{tenant_id}</tt>


;Response:
;Response:
Line 72: Line 72:
Creates a new Tenant
Creates a new Tenant
;Method:POST
;Method:POST
;URI:<tt><nowiki>https://{domain}/networking/rest/tenant</nowiki></tt>
;URI:<tt>{{platformURL}}/rest/tenant</tt>


;Request:
;Request:
Line 108: Line 108:
<partner>{customer_id}</partner>  
<partner>{customer_id}</partner>  
</syntaxhighlight>
</syntaxhighlight>
::*To preload the new tenant's applications (overriding the list specified in the [[Service Provider Settings]], [[Service_Provider_Settings#Tenant_Configuration|Tenant Configuration]] section), add a comma-separated list of package IDs like the following:
:::<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.


;Response:
;Response:
Line 124: Line 133:
===Search Tenants===
===Search Tenants===
;Method:GET
;Method:GET
;URI:<tt><nowiki>https://{domain}/networking/rest/tenant?{query_parameters}</nowiki></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>
Line 134: Line 143:
Updates Tenant information
Updates Tenant information
;Method:PUT
;Method:PUT
;URI:<tt><nowiki>https://{domain}/networking/rest/tenant/{tenant_id}</nowiki></tt>
;URI:<tt>{{platformURL}}/rest/tenant/{tenant_id}</tt>


;Request:
;Request:
Line 162: Line 171:
Deletes a Tenant, and all related information
Deletes a Tenant, and all related information
;Method:DELETE
;Method:DELETE
;URI:<tt><nowiki>https://{domain}/networking/rest/tenant/{tenant_id}</nowiki></tt>
;URI:<tt>{{platformURL}}/rest/tenant/{tenant_id}</tt>


;Response:
;Response:

Latest revision as of 21:47, 30 March 2012

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://na.longjump.com/networking/rest/tenant/{tenant_id}
Response
<platform>
    <tenant>
        <id>1479765335</id>
        <object_id>8c5b349851c041a28d19277a12dee8f0</object_id>
        <document_space/>
        <classification/>
        <partner type="" 
            uri="https://{domain}/networking/rest/tenant/1384998015" 
            displayValue="MSP 15">1384998015</partner>
        <trial_days/>
        <deleted/>
        <created_id type="" 
            uri="https://{domain}/networking/rest/record/USER/1" 
            displayValue="">1</created_id>
        <owner_id type="" 
            uri="https://{domain}/networking/rest/record/USER/5" 
            displayValue="Admin">5</owner_id>
        <modified_id type="" 
            uri="https://{domain}/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/>
        <partner_id>597083057</partner_id>
        <country>United States</country>
        <next_billing_date/>
        <base_subscriber_plan type="" 
            uri="https://{domain}/networking/rest/record/456zzy789jhk/null" 
            displayValue=""/>
        <trial_account/>
        <accessory_purchase_plan type="" 
            uri="https://{domain}/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://{domain}/networking/rest/record/456zzy789jhk/null" 
            displayValue=""/>
        <msp>0</msp>
        <discount/>
        <workflow_state/>
        <active>1</active>
    </tenant>
    <message>
        <code>0</code>
        <description>Success</description>
    </message>
</platform>
See also: REST API:Error Codes

Create a Tenant

Creates a new Tenant

Method
POST
URI
https://na.longjump.com/networking/rest/tenant
Request
<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>
        <estimated_number_of_users>4</estimated_number_of_users>
        <country>United States</country>
        <date_format>mm/dd/yyyy</date_format>
        <currency_format>$</currency_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>
Notes
  • To create a new MSP, pass the following with the request:
<is_partner>1</is_partner>
  • To create a new tenant for an MSP, pass the following with the request, where {customer_id} is the MSP's tenant ID:
<partner>{customer_id}</partner>
<appList>4949678694fe4ccd9dcdfd9c32c49521,
         eodf3997d57d4c7bb57f28d4e58d364f</appList>
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.
Response
<platform>
    <message>
        <code>0</code>
        <description>Success</description>      
        <id>...</id>  <!-- tenant ID -->  
    </message>
</platform>
See also: REST API:Error Codes

Search Tenants

Method
GET
URI
https://na.longjump.com/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
  • Use the REST API:field Resource to get a complete list of fields
  • Field lists for database views need to specify the object's alias, as well as the field name.
  • 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:
<platform> 
   ...
   <message>
      <code>0</code>
      <description>Success</description>
   </message>

   <!-- added by the query param -->
   <totalRecordCount>N</totalRecordCount> 
</platform>
  • 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://na.longjump.com/networking/rest/tenant/{tenant_id}
Request
<platform>
<tenant>
    <free>1</free>
    <country>India</country>
    <payment_type>Manual</payment_type>
</tenant>
</platform>
Response
<platform>
    <message>
        <code>0</code>
        <description>Success</description>        
    </message>
</platform>
See also: REST API:Error Codes

Delete a Tenant

Deletes a Tenant, and all related information

Method
DELETE
URI
https://na.longjump.com/networking/rest/tenant/{tenant_id}
Response
<platform>
    <message>
        <code>0</code>
        <description>Success</description>        
    </message>
</platform>
See also: REST API:Error Codes

Fields

Name Type Attributes Required During Add Description Additional Information
company String Checkmark.gif Company Name
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
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
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