AgileApps Support Wiki Pre Release

Difference between revisions of "REST API:class Resource"

From AgileApps Support Wiki
imported>Aeric
m (Text replace - 'Record Identifier' to 'Record Id')
imported>Aeric
 
(7 intermediate revisions by the same user not shown)
Line 2: Line 2:


===Access Permissions===
===Access Permissions===
:* [[Develop Tools]] permission must be enabled for the tenant.
{{permissions|Use Development Features|use this resource.}}
{{permissions|Manage Develop Features|use the <tt>class</tt> resource.}}


===Get a Class===
===Get a Class===
Line 9: Line 8:
;Method:GET
;Method:GET


;URI:<tt><nowiki>https://{domain}/networking/rest/class/{recordId}</nowiki></tt>
;URI:<tt>{{platformURL}}/rest/class/{recordId}</tt>


;Response:
;Response:
Line 22: Line 21:
         <date_created>2010-11-12T13:14:15Z</date_created>
         <date_created>2010-11-12T13:14:15Z</date_created>
         <created_id type="USER"
         <created_id type="USER"
           uri="https://{domain}/networking/rest/user/17331c7c353a4b72b956fcf2cd9c828f"  
           uri="https://{{domain}}/networking/rest/user/17331c7c353a4b72b956fcf2cd9c828f"  
  displayValue="John Doe">17331c7c353a4b72b956fcf2cd9c828f</created_id>
  displayValue="John Doe">17331c7c353a4b72b956fcf2cd9c828f</created_id>
         <date_modified>2010-11-12T13:14:15Z</date_modified>
         <date_modified>2010-11-12T13:14:15Z</date_modified>
         <modified_id type="USER"
         <modified_id type="USER"
  uri="https://{domain}/networking/rest/user/17331c7c353a4b72b956fcf2cd9c828f"  
  uri="https://{{domain}}/networking/rest/user/17331c7c353a4b72b956fcf2cd9c828f"  
  displayValue="John Doe">17331c7c353a4b72b956fcf2cd9c828f</modified_id>
  displayValue="John Doe">17331c7c353a4b72b956fcf2cd9c828f</modified_id>
     </class>
     </class>
Line 44: Line 43:
;Method:POST
;Method:POST


;URI:<tt><nowiki>https://{domain}/networking/rest/class</nowiki></tt>
;URI:<tt>{{platformURL}}/rest/class</tt>


;Request:
;Request:
Line 82: Line 81:
;Method:PUT
;Method:PUT


;URI:<tt><nowiki>https://{domain}/networking/rest/class/{recordId}</nowiki></tt>
;URI:<tt>{{platformURL}}/rest/class/{recordId}</tt>


;Request:
;Request:
Line 119: Line 118:
;Method:DELETE
;Method:DELETE


;URI:<tt><nowiki>https://{domain}/networking/rest/class/{recordId}</nowiki></tt>
;URI:<tt>{{platformURL}}/rest/class/{recordId}</tt>


;Response:
;Response:
Line 138: Line 137:
;Method:GET
;Method:GET


;URI:<tt><nowiki>https://{domain}/networking/rest/class?{query_parameters}</nowiki></tt>
;URI:<tt>{{platformURL}}/rest/class?{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 155: Line 154:
         <package_name>com.platform.namespace1.test.javatest</package_name>
         <package_name>com.platform.namespace1.test.javatest</package_name>
         <date_created>2010-11-12T13:14:15Z</date_created>
         <date_created>2010-11-12T13:14:15Z</date_created>
         <created_id type="USER" uri="https://{domain}/networking/rest/user/17331c7c353a4b72b956fcf2cd9c828f" displayValue="John Doe">17331c7c353a4b72b956fcf2cd9c828f</created_id>
         <created_id type="USER" uri="https://{{domain}}/networking/rest/user/17331c7c353a4b72b956fcf2cd9c828f" displayValue="John Doe">17331c7c353a4b72b956fcf2cd9c828f</created_id>
         <date_modified>2010-11-12T13:14:15Z</date_modified>
         <date_modified>2010-11-12T13:14:15Z</date_modified>
         <modified_id type="USER" uri="https://{domain}/networking/rest/user/17331c7c353a4b72b956fcf2cd9c828f" displayValue="John Doe">17331c7c353a4b72b956fcf2cd9c828f</modified_id>
         <modified_id type="USER" uri="https://{{domain}}/networking/rest/user/17331c7c353a4b72b956fcf2cd9c828f" displayValue="John Doe">17331c7c353a4b72b956fcf2cd9c828f</modified_id>
     </class>
     </class>


Line 167: Line 166:
         <package_name>com.platform.namespace1.test.javatest</package_name>
         <package_name>com.platform.namespace1.test.javatest</package_name>
         <date_created>2010-11-12T13:14:15Z</date_created>
         <date_created>2010-11-12T13:14:15Z</date_created>
         <created_id type="USER" uri="https://{domain}/networking/rest/user/17331c7c353a4b72b956fcf2cd9c828f" displayValue="John Doe">17331c7c353a4b72b956fcf2cd9c828f</created_id>
         <created_id type="USER" uri="https://{{domain}}/networking/rest/user/17331c7c353a4b72b956fcf2cd9c828f" displayValue="John Doe">17331c7c353a4b72b956fcf2cd9c828f</created_id>
         <date_modified>2010-11-12T13:14:15Z</date_modified>
         <date_modified>2010-11-12T13:14:15Z</date_modified>
         <modified_id type="USER" uri="https://{domain}/networking/rest/user/17331c7c353a4b72b956fcf2cd9c828f" displayValue="John Doe">17331c7c353a4b72b956fcf2cd9c828f</modified_id>
         <modified_id type="USER" uri="https://{{domain}}/networking/rest/user/17331c7c353a4b72b956fcf2cd9c828f" displayValue="John Doe">17331c7c353a4b72b956fcf2cd9c828f</modified_id>
     </class>
     </class>


Line 189: Line 188:
|-
|-
| name || String || Read Only || align="center"|[[File:Checkmark.gif|link=]]  
| name || String || Read Only || align="center"|[[File:Checkmark.gif|link=]]  
|| Class name ||  
|| Class name || Must consist of alphanumeric characters (a-z,A-Z,0-9) or underscores (_). Must start with an alphabetic character (a-z,A-Z) or underscore (_).
|-
|-
| package_name || String ||  || || The fully qualified name of the package that contains the class. || Not required. Supported only for backward compatibility.<br>Example: <tt>com.platform.{namespace}.{package}</tt>
| package_name || String ||  || || The fully qualified name of the package that contains the class. || Not required. Supported only for backward compatibility.<br>Example: <tt>com.platform.{namespace}.{package}</tt>

Latest revision as of 06:32, 10 May 2017

Access and update platform-extension classes.

Access Permissions

Lock-tiny.gif

Users that have the Use Development Features permission can use this resource. 

Get a Class

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

<platform>

   <class>
       <id>741be7784a314c54befb0724a0b97cc8</id>
       <name>Test4</name>
       public class Test4{ }
       <package_name>com.platform.namespace1.test.javatest</package_name>
       <is_global_class>false</is_global_class>
       <date_created>2010-11-12T13:14:15Z</date_created>
       <created_id type="USER"
         uri="https://{yourDomain}/networking/rest/user/17331c7c353a4b72b956fcf2cd9c828f" 

displayValue="John Doe">17331c7c353a4b72b956fcf2cd9c828f</created_id>

       <date_modified>2010-11-12T13:14:15Z</date_modified>
       <modified_id type="USER"

uri="https://{yourDomain}/networking/rest/user/17331c7c353a4b72b956fcf2cd9c828f" displayValue="John Doe">17331c7c353a4b72b956fcf2cd9c828f</modified_id>

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

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Add a Class

Add a class to the test package in the dev namespace.

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

<platform>

   <class>      
       <name>ClassTest</name>
       <is_global_class>false</is_global_class>
       <![CDATA[package com.platform.dev.test;
       public class ClassTest
       {
           public static void test(String[] args)
           {
              // ...        
           }          
       }]]>         
   </class>  

</platform> </syntaxhighlight>

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

<platform>

   <message>
       0
       <description>Success</description>
       <id>18184374</id>      --ID of the added class
   </message>

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Update a Class

Update a class in the test package, in the dev namespace.

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

<platform>

   <class>      
       <name>ClassTest</name>
        <is_global_class>false</is_global_class>
       <![CDATA[package com.platform.dev.test;
       public class ClassTest
       {
           public static void test(String[] args)
           {
               // ...             
           }          
       }]]>         
   </class>  

</platform> </syntaxhighlight>

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

<platform>

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

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Delete a Class

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

<platform>

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

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Dynamic Search

Search for class records.

Method
GET
URI
https://{yourDomain}/networking/rest/class?{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
Response
<syntaxhighlight lang="xml" enclose="div">

<platform>

   <class>
       <id>741be7784a314c54befb0724a0b97cc8</id>
       <name>Test4</name>
       public class Test4{}
       <is_global_class>false</is_global_class>
       <package_name>com.platform.namespace1.test.javatest</package_name>
       <date_created>2010-11-12T13:14:15Z</date_created>
       <created_id type="USER" uri="https://{yourDomain}/networking/rest/user/17331c7c353a4b72b956fcf2cd9c828f" displayValue="John Doe">17331c7c353a4b72b956fcf2cd9c828f</created_id>
       <date_modified>2010-11-12T13:14:15Z</date_modified>
       <modified_id type="USER" uri="https://{yourDomain}/networking/rest/user/17331c7c353a4b72b956fcf2cd9c828f" displayValue="John Doe">17331c7c353a4b72b956fcf2cd9c828f</modified_id>
   </class>
   <class>
       <id>9d5cff9f10494ce7b7b3df87999bb870</id>
       <name>Test</name>
       public class Test  {  }
       <is_global_class>false</is_global_class>
       <package_name>com.platform.namespace1.test.javatest</package_name>
       <date_created>2010-11-12T13:14:15Z</date_created>
       <created_id type="USER" uri="https://{yourDomain}/networking/rest/user/17331c7c353a4b72b956fcf2cd9c828f" displayValue="John Doe">17331c7c353a4b72b956fcf2cd9c828f</created_id>
       <date_modified>2010-11-12T13:14:15Z</date_modified>
       <modified_id type="USER" uri="https://{yourDomain}/networking/rest/user/17331c7c353a4b72b956fcf2cd9c828f" displayValue="John Doe">17331c7c353a4b72b956fcf2cd9c828f</modified_id>
   </class>
   <message>
       0
       <description>Success</description>
   </message>
   <recordCount>2</recordCount>

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Fields

Name Type Attribute Required During Add Description Additional Information
id String Read Only Record Id
name String Read Only Checkmark.gif Class name Must consist of alphanumeric characters (a-z,A-Z,0-9) or underscores (_). Must start with an alphabetic character (a-z,A-Z) or underscore (_).
package_name String The fully qualified name of the package that contains the class. Not required. Supported only for backward compatibility.
Example: com.platform.{namespace}.{package}
is_global_class Boolean True if the class is a Global Class
code String Class definition
date_created Data Read Only
created_id Lookup Read Only
date_modified Date Read Only
modified_id Lookup Read Only