Using a special character in a REST request
REST API requests use encoding for characters that a browser can misinterpret. The following example uses hexadecimal encoding in the body of the REST API request to rename a folder to a new path in the default volume:
PUT /ihub/v1/folders/340000000100 HTTP/1.1
Host: myserver.mycompanyname.com:5000
Content-Type: application/x-www-form-urlencoded
AuthId: <authId>
 
newName=%2FPublic%2FApplication1
Always encode characters that have a specific meaning in a URI when you use them in other ways. An ampersand introduces a parameter in a URI, so you must encode an ampersand that appears in a value string. For example, use:
&description=AT%26T
instead of:
&description=AT&T
Table 15‑1 describes the available character substitutions.
Table 15‑1 Encoding sequences for use in URIs
Character
Encoded character substitution
ampersand (&)
%26
asterisk (*)
%2a
at (@)
%40
backslash (\)
%5c
colon (:)
%3a
comma (,)
%2c
dollar sign ($)
%24
double quote (")
%22
equal (=)
%3d
exclamation (!)
%21
forward slash (/)
%2f
greater than (>)
%3e
less than (<)
%3c
number sign (#)
%23
percent (%)
%25
period (.)
%2e
plus (+)
%2b
question mark (?)
%3f
semicolon (;)
%3b
space ( )
%20
underscore (_)
%5f
Using AuthId, Locale, and TargetVolume parameters
All Actuate REST API resources except POST login use the authId URL parameter. All Actuate REST API resources use locale and targetVolume URL parameters. The HTTP header for all Actuate REST API resources provides equivalent fields for these parameters. To avoid re-use of URLs to access iHub information, use the HTTP header fields rather than URL parameters to send these values to iHub.
The AuthId header field is equivalent to the authId URL parameter. In any request, you can set the value of the AuthId field in the HTTP header to the AuthId value returned by the POST login resource.
The Locale header field is equivalent to the locale URL parameter. The locale value specifies a locale code, assigning a language and country to format values to match localized conventions. The format of the locale value is a two-letter language code and a two‑letter country code separated by an underscore. The default value is set in the constants.js configuration file. Java defines the language and country codes.
The TargetVolume header field is equivalent to the targetVolume URL parameter. The target volume value sets the name of the iHub volume to which to make requests. The default value is set in the constants.js configuration file.
Using search functionality
REST API requests that return a list of resources from iHub, such as /files,
/folders, /jobs, /bookmarks, /users, or /usergroups, accept a search query parameter. The search value limits the results to those resources with a name that matches the specific search value. To search for names with a substring or character, use wildcard characters. For example, a search value of 'ab*' returns a resource with the name absolutevalues but not resources with the names databank or bankstatements.
About privileges
Privileges control the visibility and actions available to users for specific files and folders. By default, all privileges are denied. To grant privileges, a user or user group must appear in the access control list (ACL) for a file or folder. The privileges granted are listed in the Permission property of the ACL. Available privileges are Delete, Execute, Grant, Read, Secure Read, View, and Write. The Administrator user and Administrators user group have all privileges for every file and folder in the volume, even though the Administrator user and Administrators user group do not appear in every ACL. Every user is a member of the All user group. If the All user group provides access to a file or folder in a volume, every user of that volume receives that access.
About response codes
All REST API requests respond with a standard set of HTTP response codes that identify the results of the request. The standard set of response codes for the Actuate REST API are as follows:
*200: Successful deletion, cancellation, retrieval of content, and updates to existing resources
*201: Successful creation of new resources
*304: Failure to update a resource or a duplicate request
*400: Failure to complete a request, including no privilege to perform requested operation or an incorrect value format for a parameter
*401: Failure to delete a resource
*404: Failure to find a resource
The body of the response includes more information in the case of an error. For example, the following response is for a GET folders/{folderId} request that specifies a non-existent identifier:
{
"error": {
"description": "The specified item ID does not exist in the Encyclopedia volume : 123456789012.",
"parameters": "123456789012",
"code": "3073",
"message": "getFileDetails failed"
}
}
Fetching a large number of items
REST API requests that return a list of resources from iHub, such as /files,
/folders, /jobs, /users, or /usergroups, accept a fetchSize query parameter that limits the number of items to return at one time. When fetchSize is not specified, lists return the number of entries set in the FETCHSIZE configuration parameter in the constants.js configuration file. The number of items found is available from the TotalCount field in the response object. When the TotalCount exceeds the fetchSize, the response object also includes a fetchHandle field that provides access to the next set of data from the returned list. For example, if fetchSize is set to 1, and the total number of users found is 28, a GET users request using a fetchSize of 1 returns the following response object:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
 
{
"Users": {
"User": [
{
"Id": "100000000000",
"Name": "Administrator",
"Description": {},
"EmailAddress": {},
"HomeFolder": "/Home/administrator"
}]
},
"FetchHandle": "RklMRU9SRk9MREVSICx8IHRydWUgLHwgKiAsfHwgMDoxMDowOjAgLHwgKiAsfHwgMDoxOjA6MA==",
"TotalCount": "28"
}
To request the next user from the list, use a second request for users and include the fetchHandle as the only query parameter in the request, similar to the following:
GET /ihub/v1/users?fetchHandle=RklMRU9SRk9MREVSICx8IHRydWUgLHw
gKiAsfHwgMDoxMDowOjAgLHwgKiAsfHwgMDoxOjA6MA== HTTP/1.1
host: myserver.mycompanyname.com:5000
AuthId: <authId>
The response includes another fetchHandle for the next set from the list. You can iterate through the list using fetchHandle in one direction. If fetchDirection is set, the list order applies to all the results. You cannot change the value of fetchDirection to go backwards through a list.
Handling HTTPS requests using the REST API
The REST service for the REST API runs in HTTP mode by default. To enable HTTPS support, edit the constants.js configuration file and change the value of the USEHTTPS parameter to true. You must restart the REST server service to commit the changes. By default, the REST service responds to HTTPS requests on port 5010. Configure the port using constants.js, as described in Configuring the REST API using constants.js.
Stopping and starting the REST service
Use System Console to stop and start the REST service that runs on iHub. If System Console is not installed, stop and start the iHub itself to stop and start the REST service.
If the REST service is deployed on a different machine, open a command window and navigate to the RESTAPI\server folder. To start the REST service, type the following command and press Enter:
node app.js
To stop the service, press Ctrl+C.
How to use System Console to control the REST service
1 Using a browser, navigate to System Console. The default URL is:
http://<server name>:8500/sysconsole
2 Log in as the administrator user. The default user name is sysadmin. The default password is system11.
3 Select Clusters. Select the cluster to control. Cluster Configuration appears.
4 Select REST Service Server. On the menu that appears, choose Stop Service. REST Service Server changes from green to yellow.
5 Using the Manage Cluster menu, choose Refresh. When REST Service Server becomes red, the service has stopped.
6 To restart the service, select REST Service Server. On the menu that appears, choose Start Service. REST Service Server changes from red to yellow.
7 Using the Manage Cluster menu, choose Refresh. When REST Service Server becomes green, the service has started.
How to use Windows services to control the REST service
1 In the Windows Start menu, type Services. In the list that appears, select Services.
2 Select Actuate iHub 3.1 Service. Choose ActionStop. The service, including the REST service, stops.
3 Select Actuate iHub 3.1 Service. Choose ActionStart. The service, including the REST service, starts.
Configuring the REST API using constants.js
You can configure the behavior of REST API resources by editing the constants.js configuration file. Constants.js is installed with iHub in the following path:
<iHub installation folder>\modules\BIRTiHub\iHub\RESTAPI
\server\config
For REST API deployed separately from iHub, constants.js is located in the following path:
<Deployment folder>\server\config
Table 15‑2 lists and describes the parameters in the constants.js configuration file.
Table 15‑2 Parameters in constants.js
Parameter
Description
AUTH_ID_
HEADER
String. Reserved. The default value is authId.
CLUSTER_
WORKERS
Integer. The number of additional Node.js worker processes to use for the REST service. The default value is -1, which uses a single master process and no additional worker processes.
ENABLE_DOCS
Boolean. Enables interactive documentation. The default value is true.
FETCHSIZE
Integer. The default number of entries to return for a GET request that returns a list, such as /files, /folders, /users, and /usergroups. The fetchSize parameter for these requests overrides this value. The default value is 10.
GLOBALAGENT
JSON string. The number of sockets and listeners to use for the REST service. To improve the performance of the REST service, increase these values. Monitor the system to check the results of the changes. The maximum number of sockets to use is dependent on the operating system. Increasing the number of listeners above 40 has no effect. The default values are:
{
MAXSOCKETS:15,
MAXLISTENERS: 15
}
HOST_NAME
String. The iHub host name, which can be an IP address or a host and domain name. The default value is the full name of the server on which iHub is installed. For example:
myserver.mycompanyname.com
HTTPS_CERT_
LOCATION
String. The path to the HTTPS certificate. By default, the REST API uses the iHub HTTPS certificate. The default value is:
<iHub installation folder>/modules/BIRTiHub
/iHub/RESTAPI/../../shared/config
/credentials/birtihub.crt
HTTPS_KEY_
LOCATION
String. The path to the HTTPS key. By default, the REST API uses the iHub HTTPS key. The default value is:
<iHub installation folder>/modules/BIRTiHub
/iHub/RESTAPI/../../shared/config
/credentials/birtihub.crt.key
HTTPS_PORT
Integer. The port set to respond to HTTPS requests. HTTPS support must be enabled using the USEHTTPS parameter.
LOCALE
String. Localizes content, such as currency and time format, to a particular country and language as defined by Java. The default value is en_US.
LOG_LEVEL
String. The level of detail to send as messages about REST server activity to the logs\app.log file. Valid values are defined by the java.util.logging.Level class. The default value is INFO.
SCOPE
String. The context root to use for the REST API. To use interactive documentation for a non-default value of SCOPE, you must also change a configuration file, as described in How to set up the REST service on a separate Windows node or machine. The default value is ihub.
TARGETVOLUME
String. The default iHub volume for REST API requests. The targetVolume parameter in the HTTP header overrides this value. The default value is Default Volume.
URIPATHS
JSON string. Reserved. The default value is:
{
LOGIN: "/login",
FOLDERS: "/folders",
FILES: "/files",
USERS: "/users",
USERGROUPS: "/usergroups",
DATAOBJECT: "/dataobject",
VISUALS: "/visuals",
JOBS:"/jobs"
}
USEHTTPS
Boolean. True enables HTTPS support. False disables HTTPS support. The default value is false.
VERSION
String. Reserved. The default value is v1.
WSDL_PATH
String. The path to the WSDL definition for the axis service. The default value is:
<iHub installation folder>/modules/BIRTiHub
/iHub/RESTAPI/server/wsdl.xml