This guide demonstrates how to use the JSON REST API. The guide uses the cURL command-line tool (available in both Linux and Windows) but the same elements apply no matter what library or tool you are using to interact with the REST API.
These features require that the rest module be included when you run createproject to create the project directories.
REST API Parameters
The master list of QueryRequest REST parameters is on the HTTP REST APIs page.
View incoming links.
Experimenting with the REST API
The examples on this page use the cURL command-line tool to issue JSON REST API commands. For instance, this is a very simple query using cURL. It uses the default Simple Query Language to search for the word "thousand":
There are two header parameters stating that this is a JSON request. The URL connects to the search port of a running AIE instance. The JSON query takes the forms of field/value pairs, as in "query: thousand". Results are returned in the Command Window as a continuous string (with no formatting). This is not very convenient if you need to examine the results. (Note that double-quotes inside the query string need to be escaped in cURL.)
We strongly encourage the use of one of the REST clients listed on the JSON REST API page primarily because they return formatted results. The cURL examples below serve as a lowest common denominator for REST API exploration. It is easy to convert the cURL syntax to fit the REST tools.
For instance, this is the same JSON REST query as it appears in the Postman tool:
The search results in Postman come back in a clearly-organized format.
This example requires your Attivio project to have been created with Attivio Platform 5.5.1 patch 175 or later. In earlier versions, the fileIngest workflow will not contain the contentPointerFromContentId component and the sample document content will not be retrieved from the store.
Adding Content to the Store
First, let's add a PDF file from local disk to the content store that we want to process with id
Creating a REST Ingest API session (connect)
Next, we need to create a REST Ingest API session in order to perform any ingestion-related tasks. We specify the fileIngest workflow for this session.
This command will return a session id in the form of a JSON string, along these lines:
We will need to specify this session ID in all future ingestion-request URLs, as shown in the commands below. Replace this sample session ID with the one from your
connect response when running these commands.
Next, we feed two documents, one with a
contentpointerid field value matching the content ID we created above:
Now we commit the indexed documents:
Lastly, we disconnect the REST Ingest API session to free up system resources:
For more information on content ingestion please refer to the REST Ingest API page.
Run a search for the documents using CGI arguments.
You can run the same search by posting a search request in JSON as well
The search results are then returned in a JSON format as follows
For more information on querying for content please refer to the REST Query API page.