AgileApps Support Wiki Pre Release

Difference between revisions of "REST API:index Resource"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
 
(17 intermediate revisions by the same user not shown)
Line 4: Line 4:


===Permissions===
===Permissions===
{{permissions|Manage Develop Features|use this resource.}}
{{permissions|Use Development Features|use this resource.}}


===Get a List of Object Indexes===
===Get a List of Object Indexes===
;Method:GET
;Method:GET
   
   
;URI:<tt><nowiki>https://{domain}/networking/rest/index/{objectName}</nowiki></tt>  
;URI:<tt>{{platformURL}}/rest/index/{objectName}</tt>  


;Response:
;Response:
Line 15: Line 15:
<platform>
<platform>
     <index>
     <index>
         <id>...</id>
         <name>AuthorIndex</name>
         <field>data</field>
         <uniqueIndex>false</uniqueIndex>
        ...
        <useInImportForMerge>false</useInImportForMerge>
        <indexFields>author_name</indexFields>
     </index>
     </index>


Line 30: Line 31:
         <description>Success</description>
         <description>Success</description>
     </message>
     </message>
     <recordCount>N</recordCount>      <!-- Number of __ records returned -->
     <recordCount>N</recordCount>      <!-- Number of indexes returned -->
</platform>
</platform>
</syntaxhighlight>
</syntaxhighlight>
Line 39: Line 40:
;Method:GET
;Method:GET
   
   
;URI:<tt><nowiki>https://{domain}/networking/rest/index/{objectName}/{indexName}</nowiki></tt>
;URI:<tt>{{platformURL}}/rest/index/{objectName}/{indexName}</tt>


;Response:
;Response:
Line 45: Line 46:
<platform>
<platform>
     <index>
     <index>
         <id>...</id>
         <id>a5baa89caa064ed995c6c14f402db379</id>
         <field>data</field>
        <objectName>Books</objectName>
        ...
        <name>AuthorIndex</name>
        <uniqueIndex>false</uniqueIndex>
        <useInImportForMerge>false</useInImportForMerge>
        <indexFields>author_name</indexFields>
        <date_created>2012-02-09T08:00:00.000Z</date_created>
         <date_modified>2012-02-13T08:00:00.000Z</date_modified>
        <modified_id
            type="USER" uri="..."
            displayValue="...">...userId...</modified_id>
     </index>
     </index>


Line 63: Line 72:
;Method:POST
;Method:POST
   
   
;URI:<tt><nowiki>https://{domain}/networking/rest/index/{objectName}</nowiki></tt>  
;URI:<tt>{{platformURL}}/rest/index/{objectName}</tt>  


;Request:
;Request:
Line 69: Line 78:
<platform>
<platform>
     <index>
     <index>
         <field>data</field>
         <name>IBSN_Index</name>
        ...
        <uniqueIndex>false</uniqueIndex>
        <useInImportForMerge>false</useInImportForMerge>
        <indexFields>ibsn_number</indexFields>
     </index>
     </index>
</platform>
</platform>
Line 91: Line 102:
;Method:PUT
;Method:PUT
   
   
;URI:<tt><nowiki>https://{domain}/networking/rest/index/{objectName}/{indexName}</nowiki></tt>  
;URI:<tt>{{platformURL}}/rest/index/{objectName}/{indexName}</tt>  


;Request:
;Request:
:(Only one field can be updated.)
:<syntaxhighlight lang="xml" enclose="div">
:<syntaxhighlight lang="xml" enclose="div">
<platform>
<platform>
     <index>
     <index>
        <id>{recordId}</id>
      <useInImportForMerge>true</useInImportForMerge>
        ...
     </index>
     </index>
</platform>
</platform>
Line 119: Line 130:
;Method:DELETE
;Method:DELETE


;URI:<tt><nowiki>https://{domain}/networking/rest/index/{objectName}/{indexName}</nowiki></tt>
;URI:<tt>{{platformURL}}/rest/index/{objectName}/{indexName}</tt>


;Response:
;Response:
Line 135: Line 146:
===Fields===
===Fields===
:''Note:'' Unless otherwise indicated, the attribute for a field is "Editable on Add or Update".
:''Note:'' Unless otherwise indicated, the attribute for a field is "Editable on Add or Update".
:{| border="1" cellpadding="5" cellspacing="0"
:{| border="1" cellpadding="3" cellspacing="0"
! Name!!Type!!Attribute!!Required on Add!!Description!!Additional Information
! Name!!Type!!Attribute!!Required on Add!!Description!!Additional Information
|-
|-
| id || String || align="center"|Read Only || || || [[Record Id]]
| id || String || align="center"|Read&nbsp;Only || || Index ID || [[Record Id]]
|-
| name || String || || align="center"|[[File:Checkmark.gif|link=]] || ||
|-
| description || String || || || ||
|-
| ...|| ... || ... || ... || ... || ...
|-
| tag || String || align="center"|Read Only || || description || AddlInfo
|-
|-
| tag || String || || || description || AddlInfo
| objectName || String || align="center"|Read Only || || Object name ||  
|-
|-
| tag || String || || align="center"|[[File:Checkmark.gif|link=]] || description || AddlInfo
| name || String || Add Only || align="center"|[[File:Checkmark.gif|link=]] || Index name ||  
|-
|-
| tag || String || align="center"|Writable on Add only || align="center"|[[File:Checkmark.gif|link=]] || description || AddlInfo
| indexFields || String || Add Only || align="center"|[[File:Checkmark.gif|link=]] || Fields that make up the index || Comma-separated list of field names
|-
|-
| ...|| ... || ... || ... || ... || ...
| uniqueIndex || Boolean || Add Only || || If true, index keys must be unique || true or '''false''' (default)
|-
|-
| ...|| ... || ... || ... || ... || ...
| useInImportForMerge || Boolean || || || If true, index is used during an import merge || true or '''false''' (default)


|-  
|-  
| colspan="6"  bgcolor="Azure" style="height:7px" |  <!-- SPACER ROW -->
| colspan="6"  bgcolor="lightblue" style="height:7px" |  <!-- SPACER ROW -->


|-
|-
Line 170: Line 173:
| modified_id || Lookup || align="center"|Read Only || || || [[REST API:User Resource|User]] ID
| modified_id || Lookup || align="center"|Read Only || || || [[REST API:User Resource|User]] ID
|}
|}
===Error Codes===
:{| border="1" cellpadding="5" cellspacing="0"
! Platform Code||with Http Status||Description
|-
| align="center"| -7000 || BAD_REQUEST (400) || Invalid index name
|}
''Learn more:''
:* See the [[REST API:Error Codes]] for common Http error codes
:* See the [{{DOCHOST}}/javadocs/constant-values.html javadoc constants] for a complete list of <tt>PlatformException</tt> error-code constants.
<noinclude>
<noinclude>


[[Category:REST API|index Resource]]
[[Category:REST API|index Resource]]
</noinclude>
</noinclude>

Latest revision as of 00:38, 8 June 2012

Manage index metadata for an Object using the REST API.

Learn more: REST API Conventions and Considerations.

Permissions

Lock-tiny.gif

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

Get a List of Object Indexes

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

<platform>

   <index>
       <name>AuthorIndex</name>
       <uniqueIndex>false</uniqueIndex>
       <useInImportForMerge>false</useInImportForMerge>
       <indexFields>author_name</indexFields>
   </index>
   <index>
        ...
   </index>
    ...
   <message>
       0
       <description>Success</description>
   </message>
   <recordCount>N</recordCount>      

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Get an Object Index

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

<platform>

   <index>
       <id>a5baa89caa064ed995c6c14f402db379</id>
       <objectName>Books</objectName>
       <name>AuthorIndex</name>
       <uniqueIndex>false</uniqueIndex>
       <useInImportForMerge>false</useInImportForMerge>
       <indexFields>author_name</indexFields>
       <date_created>2012-02-09T08:00:00.000Z</date_created>
       <date_modified>2012-02-13T08:00:00.000Z</date_modified>
       <modified_id 
            type="USER" uri="..." 
            displayValue="...">...userId...</modified_id>
   </index>
   <message>
       0
       <description>Success</description>
   </message>

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Add an Index to an Object

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

<platform>

   <index>
       <name>IBSN_Index</name>
       <uniqueIndex>false</uniqueIndex>
       <useInImportForMerge>false</useInImportForMerge>
       <indexFields>ibsn_number</indexFields>
   </index>

</platform> </syntaxhighlight>

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

<platform>

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

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Update an Object Index

Method
PUT
URI
https://{yourDomain}/networking/rest/index/{objectName}/{indexName}
Request
(Only one field can be updated.)
<syntaxhighlight lang="xml" enclose="div">

<platform>

   <index>
     <useInImportForMerge>true</useInImportForMerge>
   </index>

</platform> </syntaxhighlight>

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

<platform>

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

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Delete an Object Index

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

<platform>

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

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Fields

Note: Unless otherwise indicated, the attribute for a field is "Editable on Add or Update".
Name Type Attribute Required on Add Description Additional Information
id String Read Only Index ID Record Id
objectName String Read Only Object name
name String Add Only Checkmark.gif Index name
indexFields String Add Only Checkmark.gif Fields that make up the index Comma-separated list of field names
uniqueIndex Boolean Add Only If true, index keys must be unique true or false (default)
useInImportForMerge Boolean If true, index is used during an import merge true or false (default)
date_modified Date Read Only UTC Format
date_created Date Read Only UTC Format
created_id Lookup Read Only User ID
modified_id Lookup Read Only User ID

Error Codes

Platform Code with Http Status Description
-7000 BAD_REQUEST (400) Invalid index name

Learn more: