REST API:class Resource

From LongJump Support Wiki

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://na.longjump.com/networking/rest/class/{recordId}
Response
<platform>
    <class>
        <id>741be7784a314c54befb0724a0b97cc8</id>
        <name>Test4</name>
        <code>public class Test4{ }</code>
        <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://{domain}/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://{domain}/networking/rest/user/17331c7c353a4b72b956fcf2cd9c828f" 
	  displayValue="John Doe">17331c7c353a4b72b956fcf2cd9c828f</modified_id>
    </class>

    <message>
        <code>0</code>
        <description>Success</description>
    </message>
</platform>
See also: REST API:Error Codes

Add a Class

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

Method
POST
URI
https://na.longjump.com/networking/rest/class
Request
<platform>
    <class>      
        <name>ClassTest</name>
        <is_global_class>false</is_global_class>
        <code><![CDATA[package com.platform.dev.test;
        public class ClassTest
        {
            public static void test(String[] args)
            {
               // ...        
            }          
        }]]></code>         
    </class>  
</platform>
Response
<platform>
    <message>
        <code>0</code>
        <description>Success</description>
        <id>18184374</id>      --ID of the added class
    </message>
</platform>
See also: REST API:Error Codes

Update a Class

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

Method
PUT
URI
https://na.longjump.com/networking/rest/class/{recordId}
Request
<platform>
    <class>      
        <name>ClassTest</name>
         <is_global_class>false</is_global_class>
        <code><![CDATA[package com.platform.dev.test;
        public class ClassTest
        {
            public static void test(String[] args)
            {
                // ...             
            }          
        }]]></code>         
    </class>  
</platform>
Response
<platform>
    <message>
        <code>0</code>
        <description>Success</description>
        <id>18184374</id>
    </message>
</platform>
See also: REST API:Error Codes

Delete a Class

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

Dynamic Search

Search for class records.

Method
GET
URI
https://na.longjump.com/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
  • 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
Response
<platform>
    <class>
        <id>741be7784a314c54befb0724a0b97cc8</id>
        <name>Test4</name>
        <code>public class Test4{}</code>
        <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://{domain}/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://{domain}/networking/rest/user/17331c7c353a4b72b956fcf2cd9c828f" displayValue="John Doe">17331c7c353a4b72b956fcf2cd9c828f</modified_id>
    </class>

    <class>
        <id>9d5cff9f10494ce7b7b3df87999bb870</id>
        <name>Test</name>
        <code>public class Test  {  }</code>
        <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://{domain}/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://{domain}/networking/rest/user/17331c7c353a4b72b956fcf2cd9c828f" displayValue="John Doe">17331c7c353a4b72b956fcf2cd9c828f</modified_id>
    </class>

    <message>
        <code>0</code>
        <description>Success</description>
    </message>
    <recordCount>2</recordCount>
</platform>
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