rest_api_developers_guide_241
rest_api_developers_guide_241
Contents
Introduction ................................................................................................................. 3
REST API Full Documentation ............................................................................... 3
Prerequisites ........................................................................................................... 3
Negotiation to Obtain JWT ..................................................................................... 4
Obtaining JWT for the First Time ............................................................................ 5
Application ................................................................................................................... 7
Retrieving Application Resource ............................................................................ 7
Creating an Application Resource .......................................................................... 7
Creating an application .................................................................................... 7
Declarative Configuration ................................................................................. 8
Ingestion ...................................................................................................................... 9
SIP Ingestion .......................................................................................................... 9
Batch Ingestion ................................................................................................ 9
Receive Step ............................................................................................. 9
Ingest Step .............................................................................................. 10
Direct Ingestion .............................................................................................. 10
Search ........................................................................................................................ 12
Overview ............................................................................................................... 12
Determine what searches are available ......................................................... 13
Table Searches .............................................................................................. 13
Finding the Reference to a Search’s Data Set ........................................ 13
Getting it All Together .............................................................................. 14
SIP Searches ................................................................................................. 14
Finding the Reference to a Search’s Data Set ........................................ 14
Creating a search composition resource ....................................................... 15
Executing a Synchronous Search ........................................................................ 15
Executing an Asynchronous Search .............................................................. 16
Jobs ............................................................................................................................ 17
Viewing job definitions .......................................................................................... 17
View job instances ................................................................................................ 17
Running or scheduling a job ................................................................................. 17
Introduction
This guide is intended to provide an overview of various aspects of the OpenText™ InfoArchive (IA) platform, focusing on
REST API. It touches on several other topics that should help you understand the overall architecture, dependencies and how
the system works in general. This guide is also complementary to InfoArchive REST Reference API documentation that covers
every aspect of the REST API.
InfoArchive Reference REST API Documentation covers broad aspects of REST API resources. While this guide focuses on a
subset of those resources, it also explains how the resources work and provides examples that should help you get started.
REST is a uniform interface which defines the interface between client and server. There are four guiding principles of a
uniform interface:
• Resource based
• Manipulation of Resources Through Representations
• Self-descriptive messages
• Hypermedia as the engine of Application State (HATEOS)
Any REST client can be used to access InfoArchive REST API. You are free to use your browser’s plugins, command line
tools and standalone applications or write your own REST clients in any of the preferred languages (Java, #Net, JavaScript,
Objective-C, etc.). This guide uses the curl tool, which can be downloaded here: https://curl.haxx.se. It is a generic command
line tool used for data transfer that can be used successfully as a REST client. Depending on the operating system you use,
you may already have it installed or you may need to install it as an add-on to your existing operating system. If you do so, you
should be able to run all the examples included in this guide.
Prerequisites
The bare minimum is to have a running InfoArchive environment. If you do not have access to the running
InfoArchive environment, you will need to download the distribution and install it. An InfoArchive production
environment does not require a lot of system resources so a test InfoArchive environment can be easily deployed
on most desktops/laptops with minimum configuration (InfoArchive can even run on a Raspberry Pi).
Note about running the examples: You may copy/paste all the provided examples, but the JSON Web Token cannot
be copied/pasted for two reasons:
• JSON Web Tokens do expire. JSON Web token is explained later in this guide. So, you will need to get a
fresh token if you intend to run provided examples in your own environment.
• JSON Web Tokens included in most examples have been shortened from their original length to keep
examples shorter and clearer.
Step 1 shows the client issuing an unauthorized request (for example, Authorization header not set). Since
this request does not includes the JWT, the REST Layer will respond with a 401 Error (Step 2), forcing the
client to obtain authentication/authorization token (JWT).
Currently, IA does not provide redirection capabilities, so the client needs to be aware of where the
Authorization Service resides and how to negotiate for a JSON Web Token, which is illustrated in Step 3
and discussed in detail in next section.
NOTE: The Gateway component (part of InfoArchive Web
Application aka IAWA) of InfoArchive provides the Authentication
and Authorization services. The Gateway component can also
dispatch REST API calls to InfoArchive Server (aka IAS). It is
encouraged to route the REST API calls through the Gateway so
that the IA Servers do not need to be exposed
In this guide, most of the curl examples will not route through the gateway.
NOTE: If you are using OTDS SSO, in this mode OTDS is acting
as a OAuth2 server. The OTDS is responsible for OAuth2 clients.
To define new OTDS Clients, you must use OTDS Admin Web
Application.
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cC…",
"token_type": "bearer",
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5…",
"expires_in": 2147483646,
"scope": "administration compliance search",
"jti": "82e6a274-d8fd-4067-99f0-dcd8231b35c1"
}
The following is a practical example performing a POST request using popular the curl tool:
Application
The Application resource represents collections of applications available to a specific Tenant. InfoArchive
supports two types of applications: Table Archiving and SIP Archiving applications. The archiveType
attribute displays the value accordingly: TABLE or SIP. For more information about table and SIP archiving,
refer to the InfoArchive Configuration and Administration guides.
If successful, then the IA Server will return a Payload Collection with one or more configured IA Applications.
Creating an application
In the previous section, a new Tenant resource was created that included all the links, including the link
relations that point to a collection of applications (http://identifiers.emc.com/applications). To create a new
Application resource, a POST Method must be executed to that collection.
To create an Application resource, at a minimum, the following attributes are required: name and
archiveType (both are mandatory). We will also pass the type attribute and that should allow for the new
Application resource to be created:
After a successful call, the IA server will return a 201 Created response that includes the newly created
Application Resource.
Declarative Configuration
Declarative configuration allows one to configure multiple objects in a single REST call. These can be SIP
applications, table applications, or even both. The syntax and semantics of the declarative configuration is
explained in the Configuration Guide.
Use the http://identifiers.emc.com/configuration link relation to discover URLs for importing or exporting
declarative configurations.
The home resource supports importing a declarative configuration via PUT. This call takes the YAML as
content:
Alternatively, you can import a ZIP file that contains the configuration YAML file plus any external files that
are referenced by the YAML:
Exporting to a declarative configuration is supported on multiple levels: system, tenant, application, and
holding. For instance, to export all configuration objects of an application to a single YAML file:
For more information on the configure property, see the section on declarative configuration in the
Configuration Guide.
You can also export the declarative configuration to a ZIP file. This ZIP will then contain the YAML file as
before, but various larger pieces of content will be stored in separate files. This makes it easier to edit those
files with dedicated editors, e.g., an HTML editor for XForms. Use the Accept header to specify the desired
media type:
Ingestion
As far as InfoArchive supports two kinds of application for archiving: Table based and SIP based, then there
are two different mechanism of data ingestion to each type of applications. Both ingestion ways are covered
in the chapter.
When planning about data ingestion from the REST perspective, it is recommended to start working at the
application level via “Home Resource” -> “Tenant” -> “Application”.
SIP Ingestion
Batch Ingestion
Batch ingestion is performed in two steps: Receive SIP step and Ingest SIP step.
Every step is performed by separate REST calls.
At first, we need to find the link relation http://identifiers.emc.com/aips rooted from the single SIP application
and get an URI for the collection of AIPs by extracting href’s value for the link relation.
Based on this URI, we perform a GET call to retrieve the collection of AIP object:
When there is no SIP data ingested into the application, the response is as follows:
{
"_links": {
"self": {
"href": "http://localhost:8765/systemdata/applications/7a7b9d20-e31f-4d5c-8bc4-d74de313a424/aips"
},
"http://identifiers.emc.com/receive": {
"href": "http://localhost:8765/systemdata/applications/7a7b9d20-e31f-4d5c-8bc4-d74de313a424/aips"
},
"http://identifiers.emc.com/ingest-direct": {
"href": "http://localhost:8765/systemdata/applications/7a7b9d20-e31f-4d5c-8bc4-d74de313a424/aips?ingestDirect=true"
}
},
"page": {
"size": 10,
"totalElements": 0,
"totalPages": 0,
"number": 0
}
}
It contains only the page information and the number of relation links to perform different actions: “receive”
and “ingest-direct”.
Receive Step
We need to take an href’s value (URI) for the http://identifiers.emc.com/receive link relation rooted from the
AIP’s collection resource. It is used for the reception step.
The reception is performed by a POST request to the above link, but it is required to set up several important
parameters to set up form-data:
- -F “format=sip_zip” – it is a mandatory parameter that sets up the SIP format to be received. In the
below example, it is “sip_zip”. Receiver nod should support provided format.
- -F “[email protected]” - a parameter that contains a path to the received SIP package.
NOTE, that in the below example the SIP package is in the same folder as curl executed.
After the SIP package is received, the response contains a newly created AIP object. The response is very
large because the AIP object has many fields. The below example of response payload is truncated to show
the relation links on the whole page.
{
"id" : "6728b300-0383-497b-9faa-e205b8433aff",
"name" : "PhoneCalls-CC-1000000-1",
"application" : "http://localhost:8765/systemdata/applications/7a7b9d20-e31f-4d5c-8bc4-d74de313a424",
…
"state" : "Waiting ingestion",
…
"_links" : {
"self" : {
"href" : "http://localhost:8765/systemdata/applications/7a7b9d20-e31f-4d5c-8bc4-d74de313a424/aips/6728b300-0383-497b-9faa-
e205b8433aff"
},
"http://identifiers.emc.com/ingest" : {
"href" : "http://localhost:8765/systemdata/applications/7a7b9d20-e31f-4d5c-8bc4-d74de313a424/aips/6728b300-0383-497b-9faa-
e205b8433aff/ingest"
}
}}
The “state” attribute and its value “Waiting ingestion” confirms the newly created AIP is ready for ingestion
via the http://identifiers.emc.com/ingest link relation, included below.
Ingest Step
From that reception response, it is worth taking the URI for the http://identifiers.emc.com/ingest link
relation. It is rooted from the single AIP resource. The URI is used to perform the ingestion by issuing a
POST request without any payload.
After a successful response, the payload contains the same AIP object, but with updated attributes. To be
more explicit, we are showing on the below listing only the links relation for the AIP.
The POST request accepts a parameter named allowBackgroundRequest. If this parameter is set to true
(default value is false) and if the structured database is not available, the ingestion will failback to an
asynchronous ingestion. In this case the result will be an AIP in “Pending” State, which will contain a link
http://identifiers.emc.com/order-item to the corresponding asynchronous ingestion order item.
Direct Ingestion
When ingesting a large number of SIPs via a batch, it is first necessary to receive all the SIP packages and
then ingest them into the application, as described in the previous sections. InfoArchive’ s unitary archiving
allows for simultaneous reception\ingestion of a single SIP via an exposed REST resource, resulting in a
reduction of steps.
For performing the direct ingest, leverage the href’s value (URI) for the http://identifiers.emc.com/ingest-
direct link relation rooted from the AIP’s collection resource.
Please note the parameter “?ingestDirect=true”.
"http://identifiers.emc.com/ingest-direct": {
"href": "http://localhost:8765/systemdata/applications/7a7b9d20-e31f-4d5c-8bc4-
d74de313a424/aips?ingestDirect=true"
}
The direct ingest is performed by POST request to the above link, but it is required to set up the same
parameters that were discussed for Batch Ingestion: -F “format=sip_zip” and -F
“[email protected]”, see below:
In case of a successful response, you may notice that in the response payload the AIP state is “Completed”.
Search
Overview
Search is one of the primary and frequently used resources in InfoArchive. In the resource hierarchy,
searches are located under Home Resource->Tenants->Applications->Searches)
The search resource is a composite resource that consists of several, independent resources, logically
creating one higher level resource. This approach allows for some flexibility.
See the following hierarchy representation, showing similarities and differences, for Searches depending
on what application they are associated with. You will notice that there are some differences whether a
search is created for application of archivalType: TABLE versus application of archivalType: SIP – see
below:
Each search needs to be associated with a Data Set and, depending on which application a given search
is rooted with, that Data Set could be:
• Searches rooted under SIP Application
o A Data Set is a combination of AIC and Query resources. It is worth pointing out that a search
resource does not contain these resources itself, but instead, has links to such. For example,
a SIP application has link relations to a collection of AICs and to a collection of Queries, where
the objects are persisted and a whole collection can be explored from the root application
resource. Moreover, not all combinations of AIC and Query are possible. AIC is bound to a
certain number of configured Queries. In the next chapters, it is explained how to find correct
AIC and Query pair for the search.
• Searches rooted under Table Application
o Data Set could be either a Database or Schema/Table. If your search can be narrow down to
a single table query, it is best to set both: Schema and Table references when creating search.
Setting Table reference is crucial if you want to allow users ability to put holds/retention on the
search results (if search has no Table reference set, users will not be able to put search results
on holds for example).
o For cross-table searches only Schema reference should be set as then search is run on the
Schema.
o For cross-schema searches only Database reference should be set.
Effectively, we need to do a GET on the search resources that are available from an application.
To help facilitate this procedure, install the sample Audit application, which has some default searches available.
From the applications link, find the searches link.
curl -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9..’ -H 'Accept: application/hal+json'
"http://localhost:8765/systemdata/applications/800c33e2-c88e-4bf9-9d9e-d8e7e72b7edd/searches"
Search object can be either Primary or Nested. Primary searches can refer to Nested searches (Nested search
would typically expend on the results returned to Primary search.
By default, collection of searches returns all searches, regardless of whether they are Primary or Nested.
Search also can be in any of the two states: DRAFT or PUBLISHED. By default, collection of searches returns all
searches, regardless of the state.
Table Searches
Step #1
This example leverages the Searches associated with the TABLE Type, “Baseball” application, which needs to be
found in the collection. Once found, take note of the link relation “http://identifiers.emc.com/databases and
“http://identifiers.emc.com/searches”. We will need both href values URIs to be use later in Step #2 and Step #6,
respectively.
See example below:
Step #3
Step #2 returns a collection of databases for the Baseball application, and we’ll process it to find database of interest
to us and then examine its _links node to find the link relation to schemas (http://identifiers.emc.com/schemas).
When we do, we issue a GET on it:
Step #4
Step #3 returns a collection of schemas. Find the schema of interest in the array and, for that schema, find the self-
link relation and its value, and save the value to be used in Step #6 tables (http://identifiers.emc.com/tables).
Step #5
Issue a GET on the value of the table’s link relation:
Now iterate over the collection of tables and find the table of interest, comparing name attributes of each item in the
array until we find the one, we want. Let us say we will be looking for table SALARIES. When found, store the value
of its reference URI (value of href attribute on self-link relation), since it is needed in Step #4.
Getting it All Together
Step #6
Now that we know the reference to our collection of searches (Step #1), we also know the reference to both the
Schema (Step #4) and Table (Step #5) we are ready to create our first search.
We will need to do a POST to our collection of searches, and we will pass the search’s attributes in a JSON payload.
To create a search for a TABLE archiving application, we need to set the following attributes: name, description
(optional), schema and table.
SIP Searches
Let us say we are looking for Searches associated with the PhoneCalls application, which is a SIP application. To
find the application, we must use the same response, which is received by issuing a GET on the relation link to the
collection of applications. This time, we process every item in the response array until we meet application with
name == PhoneCalls.
The response for that request contains an array of AICs. Assume that the array contains a single element, which is
named “PhoneCalls-aic”. What is required for now is to find the self-link relation for that item and save its value for
a while in notepad or any other desired text editor.
Now it is time to find a reference for a required single Query object.
NOTE: There are two roots from where a collection of Queries can
be retrieved: application root and AIC root. Both roots have the
same link relation http://identifiers.emc.com/queries, which
contains the href’s value to the URI for the collection of Queries.
It worth pointing out that all Queries that exist in the system can be
found from application root.
For defining the search, we need to retrieve and only select the Queries that are bounded with a certain AIC.
Otherwise, you may select an inappropriate Query object for that given AIC, which will lead to from search
configuration.
That is why we need to perform a GET on the URI from the selected AIC root and find a relation for the collection
of queries to take href’s value for bounded queries for that AIC.
If the name is unique, that POST should be successful, and we should get back a 201 Created response code and
the payload should contain the newly created search-composition resource.
Payload should be enclosed in <data></data> XML nodes. So, you will see that in the example below, in which we
set search the input value to birthYear 2013-01-01.
<data><birthYear>2013-01-01</birthYear><birthMonth>July</birthMonth></data>
As you can see, we also set the time out to 300 seconds, which is excessive.
Let us try to execute this now.
Jobs
Job definitions indicate which jobs can be done. Job Instances represent a run of the job. Job instances can be
scoped to the system, tenant, or application.
When accessing via rest, the resources are accessed directly of the home resource.
About OpenText
OpenText enables the digital world, creating a better way for organizations to work with
information, on premises or in the cloud. For more information about OpenText (NASDAQ:
OTEX, TSX: OTC) visit opentext.com.
Connect with us:
Copyright © 2023 Open Text. All rights reserved. Trademarks owned by Open Text.