REST API:class Resource
From AgileApps Support Wiki
Access and update platform-extension classes.
Access Permissions
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
<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://{yourDomain}/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://{yourDomain}/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://{yourDomain}/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://{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
- For more examples, see Filter Expressions in REST APIs and the REST API Examples.)
- 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> <status> <packageDeploy> ... </packageDeploy> </status> <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)
- sortBy - Field name for primary sort
- 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 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