agilePointAPI

This section gives information about the JavaScript methods that can call the AgilePoint REST API methods from an eForm.

Note: The information on this page has a different organization than other JavaScript methods because agilePointAPI uses two methods — get and post — instead of one, and the JavaScript syntax to call the API methods is different when used in an eForm versus an external app.

Background and Setup

Other Examples

Prerequisites

  • AgilePoint NX v8.0 Software Update 1 and higher

Good to Know

  • Any AgilePoint REST API method can be called with JavaScript in an eForm.

    For more information, refer to Methods for REST API

  • The JavaScript method to call an AgilePoint REST API method depends on whether the API method is a GET or POST type method.
  • The JavaScript syntax for calling an AgilePoint API method from an eForm is different from calling an API method from an external system.

    Refer to More Information on this page.

agilePointAPI.get

Method Type

JavaScript

Description

Retrieves data from AgilePoint Server using the REST APIs.

Parameters

The method input is an object with these parameters, and a callback function.

Field NameDefinition

relativePath

Function:
Specifies the relative path for the API method.

To find the relative path, refer to the documentation for the for the associated API method: Methods for REST API.

Type
string
Accepted Values:
One line of text (a string) in URL format.

apiOptions

Function:
Specifies one or more options required to retrieve the data from the relative path.
Type
object
Accepted Values:
One or more options, separated by commas (,).

Output

A result object that gives the status, data, and error details.

Field NameDefinition

isSuccess

Function:
Specifies whether a pop-up shows when the method completes successfully.
Type
bool
Accepted Values:
  • True - The method was successful.
  • False - The method was not successful.

data

Function:
Specifies the data retreived from the GET API method.

error

Function:
Specifies an error message if an error occurs.
Type
string
Accepted Values:
The contents of an error message.

status

Function:
Specifies the status code in the response.
Type
int
Accepted Values:
An integer that represents a status code.
Example:
  • 200
  • 403

statusText

Function:
Specifies the status text in the response.
Type
string
Accepted Values:
One line of text (a string) that represents a status text.
Example:
  • OK
  • Not Found

url

Function:
Specifies the response URL for the method.
Type
string
Accepted Values:
One line of text (a string) in URL format.

Example

var options = {};
// The value Admin/GetRegisterUsers shows 
// the relative path of the Get Registered User by Name method.
options.relativePath = "Admin/GetRegisterUsers";  
		
// The API options required to retrieve the data from the specified path.
// Example: headers, referrer, mode, cache, redirect.		
options.apiOptions = {}; 
		
eFormHelper.agilePointAPI.get(options, function (result) 
{
  // Checks if the method is successful.
  if (result.isSuccess)
  
  {
    // Logs the data retrieved from the Get API method.
    console.log(result.data);
  }
  else 
    {
      // Logs errors and error descriptions.
      console.log(result.error);
    }
});

agilePointAPI.post

Method Type

JavaScript

Description

Sends data to AgilePoint Server using the REST APIs to create or change resources.

Parameters

The method input is an object with these parameters, and a callback function.

Field NameDefinition

relativePath

Function:
Specifies the relative path for the API method.

To find the relative path, refer to the documentation for the for the associated API method: Methods for REST API.

Type
string
Accepted Values:
One line of text (a string) in URL format.

apiOptions

Function:
Specifies one or more options required to retrieve the data from the relative path.
Type
object
Accepted Values:
One or more options, separated by commas (,).

Output

A result object that gives the status, data, and error details.

Field NameDefinition

isSuccess

Function:
Specifies whether a pop-up shows when the method completes successfully.
Type
bool
Accepted Values:
  • True - The method was successful.
  • False - The method was not successful.

data

Function:
Specifies the data retreived from the POST API method.

error

Function:
Specifies an error message if an error occurs.
Type
string
Accepted Values:
The contents of an error message.

status

Function:
Specifies the status code in the response.
Type
int
Accepted Values:
An integer that represents a status code.
Example:
  • 200
  • 403

statusText

Function:
Specifies the status text in the response.
Type
string
Accepted Values:
One line of text (a string) that represents a status text.
Example:
  • OK
  • Not Found

url

Function:
Specifies the response URL for the method.
Type
string
Accepted Values:
One line of text (a string) in URL format.

Example

var options = {};
// The value Admin/GetRegisterUser shows 
// the relative path of the Get Registered User by Name method.
options.relativePath = "Admin/GetRegisterUser";

// The value indicates the user name for the user to add.
options.data = { "userName": "TestUser" }; 	 

// The API options required to retrieve the data from the specified path.
// Example: headers, referrer, mode, cache, redirect.
options.apiOptions = 
  {
  headers: {"Content-Type": "application/json;"}
  };
		
eFormHelper.agilePointAPI.post(options, function (result) 
{
  // Checks if the method is successful.
  if (result.isSuccess) 
  
  { 
    // Logs the data retrieved from the POST API method.
    console.log(result.data);
  }
  else
    {
      // Logs errors and error descriptions.
      console.log(result.error);
    }
});

More Information

This section provides background information for the agilePointAPI methods.

Example: API Method Called from an eForm

Authentication and heeaders are not required when you call an AgilePoint API from an eForm with the JavaScript methods from eForms:

var options = {};
// The value Admin/GetRegisterUsers shows 
// the relative path of the Get Registered User by Name method.
options.relativePath = "Admin/GetRegisterUsers";  
		
// The API options required to retrieve the data from the specified path.
// Example: headers, referrer, mode, cache, redirect.		
options.apiOptions = {}; 
		
eFormHelper.agilePointAPI.get(options, function (result) 
{
  // Checks if the method is successful.
  if (result.isSuccess)
  
  {
    // Logs the data retrieved from the Get API method.
    console.log(result.data);
  }
  else 
    {
      // Logs errors and error descriptions.
      console.log(result.error);
    }
});

Example: API Method Called from an External App

Authentication and headers are required before a standard JavaScript API method call:

btnGetRegisterUsers").click(function () {
                    
  $.ajax({
    url: "https://mydomain:9011/AgilePointServer/Admin/GetRegisterUsers",
    type: "GET"
  });
                    
});

Code Examples in the AgilePoint NX Documentation

The AgilePoint NX Product Documentation is intended as a basic reference to help you understand how to complete basic coding tasks, such as make API or JavaScript method calls. Code examples that show specific use cases, the solutions to specific business problems, or detailed implementation scenarios are outside the scope of the AgilePoint NX Product Documentation. For specific and/or advanced types of examples that may better meet your requirements, AgilePoint provides several resources:

  • AgilePoint Community Forums - A free, AgilePoint-moderated, crowd-sourcing user forum where you can ask questions about specific techniques, the solutions to use cases, workarounds, or other topics that may not be covered in the Product Documentation.
  • Professional Services - If you can not find the information you need for your specific business problem, mentoring is available through AgilePoint Professional Services.
  • Personalized Training - AgilePoint can provide personalized training for your organization. To request personalized training, contact AgilePoint Sales.