Difference between revisions of "Java API"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
Line 162: Line 162:
:''Learn more:'' [[getStatus]]
:''Learn more:'' [[getStatus]]


==Identifying Objects and Records ==
==Finding Identifiers ==
===Object ID===
{{:Object Type Identifier}}
{{:Object Type Identifier}}
 
===Record ID===
__FORCETOC__
{{:Record Id}}
===Session ID===
{{:Session Identifier}}
===Commonly Used Constants===
{{:Commonly Used Constants}}
<noinclude>
<noinclude>


[[Category:Java API|1 (Intro & Overview)]]
[[Category:Java API|1 (Intro & Overview)]]
</noinclude>
</noinclude>

Revision as of 20:12, 12 June 2014

The Java API is a set of built-in calls that are made to programmatically customize and extend the platform.

1 About the Java API

The following platform elements provide the ability to make Java API calls from the user interface (UI):

  • Standard Java classes, to create custom business logic that models your organization's environment
  • JSP Pages, which can invoke Java APIs

2 Prerequisites

You must know the Java programming language to make the Java API calls. This includes knowing the basic elements of Java such as conditional structures (if statement), looping structures (while and for loop statements), variable declaration and assignment, use of operators, variable naming conventions, debugging techniques, and so on.

Learn more about the platform:
Learn more about web services and programming:

3 Classes, Objects, and APIs

This table lists the APIs and links to detail pages. For a quick synopsis of syntax, see the Java API Cheatsheet.

3.1 Record Handling

3.1.1 Objects

Handle records in standard Objects:
Learn more: Java_API:Record_Handling

3.1.2 Composite Objects

Operate on records in Composite Objects:
Learn more: Working with Composite Objects

3.1.3 Tenant Data Sharing

Handle records in Objects shared using Tenant Data Sharing Policies:
Learn more: Tenant_Data_Sharing_Policies#Using the JAVA API to Access Shared Data

3.1.4 Data Import

Import CSV data into Objects
Learn more: Java_API:Data Import

3.2 Email

3.3 Document Management

3.4 Transaction Management

Provides the ability to Rollback transactions to a SavePoint

Learn more: Java_API:Transaction_Management

3.5 Support Classes and Objects

Use these support classes and objects when you work with the Java API.



Learn more: Java_API:Support_Classes_and_Objects

3.6 Localization Functions

Use these functions to convert between Database Formats and localized User Formats.

Learn more: Localization

3.7 Utility Functions

Logger functions:

General-purpose operations.


Learn more: Utility functions

3.8 Customization APIs

Use these Provisional APIs give to manage metadata for program entities.

Learn more: Customize

3.9 Status

Check status of scheduled jobs.

Learn more: getStatus

4 Finding Identifiers

4.1 Object ID

An object type identifier uniquely identifies an object type. It is used to specify object types in APIs.

There are two kinds of type identifiers:

  • objectName: This identifier is a human-readable name for both System Objects and Custom Objects.
  • objectID: This identifier is a human-readable name for System Objects (e.g. "cases"), but for Custom Objects, it is a computer-generated string with no humanly-interpretable semantic value (e.g. 123qwe456rty).
See also:

To find an object type identifier:

  1. Click GearIcon.png > Customization > Objects
  2. In the Display Title column, find the object you're looking for.
  3. The Object Name column has the identifier you need.

Alternatively:

  1. Go to GearIcon.png > Customization > Objects > {object}
  2. Click Properties
  3. The object name appears at the top of the page

Notepad.png

Note:

4.2 Record ID

A record ID is a unique value used to access and update data. Record IDs can appear as: id, record_id, or recordId, depending on the tool. The record ID is used in APIs and some Formula Expressions.

Typically, the record ID is stored in a record's id field. Those fields generally are not displayed in common Views or Reports.


5 Get a Record ID Programmatically

Record IDs can be obtained using:

In the REST APIs, the record ID is stored in the id field.

To get a record ID using the Java APIs: Field values are stored in the Parameters object that is delivered to code that is running in the platform.

  • To get the ID of the record in that object, use the get method on that object, specifying 'id' as the name field to get.
  • A field of type Lookup stores the Record ID for the object it points to. To retrieve the record ID it contains, use the get specifying 'field _name' (the name of the field, in single quotes) as the field to get.
Considerations
  • Record Identifier has a Range of: 1 - 2,147,483,647
  • In most Objects, the record id is an integer
  • Exception:In these objects, the record ID is a text string:
  • Lookup fields require a string value.
To convert a numeric Record ID to a string, use the CONCAT Formula Function:
CONCAT (id, '')
    where: 
          id is a Record Identifier
          '' is two single quote (') characters

5.1 Session ID

The Session Identifier (session_id or sessionId) is used in HTTP communications to identify a series of related message exchanges, or "sessions".

Learn more: session identifier

5.2 Commonly Used Constants

Constants are defined in the CONSTANTS class. On that page, follow the links in the Nested Class Summary for a complete guide to AgileApps Cloud platform constants. For convenience, some of the more common constants used in the Java APIs are listed here.

Notepad.png

Note:

  • Constants have all-uppercase names, and are listed as static in the Field Summary. For example: static String CONTAINS
  • Some of the classes have nested classes of their own. Keep drilling down until you find the constant you need.

5.2.1 Documents

Constant Name Description Used in function
CONSTANTS.DOCUMENT.HTML HTML format generateDocument
CONSTANTS.DOCUMENT.PDF PDF format generateDocument

5.2.2 Search

Constant Name Description Used in function
CONSTANTS.SEARCH.SORT_ASCENDING Ascending order searchRecords
CONSTANTS.SEARCH.SORT_DESCENDING Descending order searchRecords

5.2.3 HttpConnection

Constant Name Description Used in function
CONSTANTS.HTTP. METHOD.GET HTTP GET request HttpConnection Constructor
CONSTANTS.HTTP. METHOD.POST HTTP POST request HttpConnection Constructor

5.2.4 Request Parameter

Constant Name Description Used in
... ... ...
CONSTANTS.SEARCH.SEARCH_RESULTS Retrieve search results