AgileApps Support Wiki Pre Release

REST API:customPage Resource

From AgileApps Support Wiki
Revision as of 19:19, 25 April 2014 by imported>Aeric (Text replace - '{domain}' to '{{domain}}')

Manage custom JSP pages using the REST API.

Access Permissions

Lock-tiny.gif

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

Get a Custom JSP Page

description

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

<platform>

   <customPage>
       <id>59038680cc06426ebc76eba6a5b75c8a</id>
       <name>TestPage.jsp</name>
       <![CDATA[ 
       <%@ page session="false" import="com.platform.api.*" %>
       <html>
       <body>
       This is test custom page
       <body>
       <html>
       ]]>
       
       <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>
   </customPage>
   <message>
       0
       <description>Success</description>
   </message>

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Add a Custom JSP Page

description

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

<platform>

   <customPage>
       <name>TestPage.jsp</name>
       <![CDATA[  
       <%@ page session="false" import="com.platform.api.*" %>
       <html>
       <body>
       This is test custom page
       <body>
       <html>
       ]]>
               
   </customPage>

</platform> </syntaxhighlight>

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

<platform>

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

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Update a Custom JSP Page

description

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

<platform>

   <customPage>
       <name>TestPage.jsp</name>
       <![CDATA[  
       <%@ page session="false" import="com.platform.api.*" %>
       <html>
       <body>
       This is test custom page
       <body>
       <html>
       ]]>
               
   </customPage>    

</platform> </syntaxhighlight>

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

<platform>

   <message>
       0
       <description>Success</description>
       <id>18184374</id>   // ID of the updated page
   </message>

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Delete a Custom JSP Page

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

<platform>

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

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Dynamic Search for Custom JSP Pages

Method
GET
URI
https://{yourDomain}/networking/rest/customPage?{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>

   <customPage>
       <id>973f210cf5804381b801700bf9feb52a</id>
       <name>test123.jsp</name>
       "hello world"
       <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>
   </customPage>
   
   <customPage>
       <id>d7c112de00ed44baa0297841fb952633</id>
       <name>UseRes.jsp</name>
       <![CDATA[  

<%@ page session="false" import="com.platform.api.*" %> <html> <body> This is test custom page <body> <html> ]]>

               
       ]]>
       
       <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>
   </customPage>
   <message>
       0
       <description>Success</description>
   </message>
   <recordCount>2</recordCount>

</platform> </syntaxhighlight>

Note:s
  • The code section is actually encoded with HTML escapes, rather than embedded in a CDATA section.
  • 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 JSP page name
code String Editable on Add/Update JSP page definition
include_header_files Boolean Editable on Add/Update Whether or not to include CSS files and jQuery javascript libraries in the page header. Default: No With headers included, the page has the same look and feel as the platform, and jQuery widgets can be used without having to import them first.
date_created Data Read Only
created_id Lookup Read Only
date_modified Date Read Only
modified_id Lookup Read Only