GlobalSearch Postman Collection
Please note that any requests for deleting GlobalSearch Objects (like database, archives, fields, lists, tables, documents, etc) will happen instantly and cannot be reversed. Use with care and consideration.
- 1 Initial Configuration
- 2 Getting a License
- 3 Deleting a License
- 4 DatabaseIDs
- 5 ArchiveIDs
- 6 SecureIDs
- 6.1 Document SecureID
- 6.1.1 Response:
- 6.2 Search SecureID
- 6.2.1 Response:
- 6.1 Document SecureID
- 7 FieldIDs
- 7.1 Get Fields
- 7.1.1 Example Response Body
- 7.2 Get Archive Fields
- 7.2.1 Example Response Body
- 7.1 Get Fields
- 8 Uploading and Indexing a Document (in Chunks)
- 8.1 Steps:
- 8.1.1 Get GlobalSearch License
- 8.1.2 Start file upload to server
- 8.1.3 Upload file chunk
- 8.1.4 Finalize Upload
- 8.1.5 Import Document from WebPortalCache
- 8.1.5.1 Example Body of Request:
- 8.1 Steps:
- 9 Uploading and Indexing a Document
- 9.1 Steps:
- 9.1.1 Get GlobalSearch License
- 9.1.2 Upload File to Server
- 9.1.3 Index the document
- 9.1.3.1 Example Body of Request:
- 9.1 Steps:
- 10 Running a search
- 11 Moving a Document
- 12 Updating Index data on a Document
Initial Configuration
Download and import postman collection below;
Create a Postman Environment with the following values;
user
- Windows or Square 9 username. If a windows domain user include the domain prefixpassword
- Password for the user, should be set to be type "secret"domain
- the FQDN of the GlobalSearch server, including the HTTP/HTTPS protocol
Using different environments in this manner allows you to quickly switch between users and GlobalSearch Servers. Note that you may have clear Postman cookies!
If you are having issues with tokens/authentication after changing environments it is likely because there is still a license token stored in the Postman cookies, see the section below for details on how to address this issue.
Getting a License
See Authentication and Licensing/Get License
GET request to /square9api/api/licenses, uses Basic Authentication to pass in user name and password.
The username and password are populated by the Postman Environment ({{user}}
and {{password}}
variables) currently in use.
Deleting a License
See Authentication and Licensing/Delete License
DEL request to /square9api/api/licenses/{token} will delete (pre GlobalSearch 6.1) or deactivate (GlobalSearch 6.1+) the given license token.
DatabaseIDs
See Database/Get Database List
Each GlobalSearch Database will have a unique database ID, these are static values and will not change under normal circumstances
Example Response Body
The response will be a JSON document with a list of the databases in the GlobalSearch Instance. Each item in the databases list will have an “Id” key/value pair, this represents the Database ID for the Database.
ArchiveIDs
See Archives\Get Archives
Each GlobalSearch Archive will have a static and unique archive ID that is used to identify the Archive.
Example Response Body
The response body will be a JSON array with each object representing one archive. The “ID” key/value pair will be the ArchiveID that is used in other Square9API requests
SecureIDs
SecureIDs are hashes used to uniquely identify a Search or a Document.
Document SecureID
See Document Actions/Get Document Secure ID
You will need to pass in the Database ID, ArchiveID and DocumentID as well as a license token.
Response:
The response if successful will simply be the document’s SecureID.
c8e570f5c59ba9e5fe0d33fc8b02906e795b27b126355bd84d6a3c3afdab647c
Search SecureID
See Searching/Get Archive Searches or Searching/Get Archive Search if you know the SearchID already
Generally any request that returns information about a search should include the Search’s SecureID. See below for an example response from Get Archive Search where we are passing in the search id via URL parameter.
Response:
The response will be a JSON document describing information about the Search, included will be the “Hash” key/value pair, this is the Search SecureID.
FieldIDs
See Field Catalog/Fields/Get Fields or Searching/Get Archive Fields
Each GlobalSearch Field will have a unique field ID, you can retrieve this information in a number of ways. If you have access to the GlobalSearch web administration interface you can quickly check the FieldID by clicking on the “Three Dots” option on the field in question.
To retrieve FieldID information from the API you will have to run one of the requests previously mentioned.
Get Fields
This request will return all of the fields on the GlobalSearch Database. The FieldID is represented by the “ID” key/value pair for each entry in the response body.
Example Response Body
At this point, Get Archive Fields is worth mentioning as unlike the Get Fields request it will limit the returned information to be the fields on the archive in question.
Get Archive Fields
Returns a list of fields tied to the Archive passed in via URL
Example Response Body
Uploading and Indexing a Document (in Chunks)
See Postman flow pictured below (while great for visualization of the process there is not a way to export/share flows from Postman at this time.)
Steps:
Get GlobalSearch License
Request: GET Authentication and Licenses/Get License
Uses Basic Authentication using the postman
{{user}}
and{{password}}
variables (pulled from Postman Environment)
Start file upload to server
Request: POST Chunking Upload/Create Archive Job
this will return the unique JobID that you will need to use in later requests
The timestamp value here needs to be unique for each job
Upload file chunk
Request: POST Chunking Upload/Upload File Chunk
Body:In this example we are assuming that the file is small enough to be reasonably uploaded in one chunk.
PDF is base64 encoded, in this case since there is only one chunk the Index value is 1
Online Base64 encoding service: Base64 Encode and Decode - Online
The Postman collection includes the
{{pdfvaluefull}}
variable which is a full PDF encoded to base64 that can be used with this request as long as you are doing a one chunk only upload.
Finalize Upload
Request: GET Chunking Upload/Finalize Upload
This will write the completed chunks to a file in the WebPortalCache directory, the return value from this request will be that file name. This file name is used in the last request when indexing the document.
Import Document from WebPortalCache
Request: POST Document Actions/Import Document from WebPortalCache
Example Body of Request:
Uses the WebPortalCache filename to index the document to the selected database/archive
Uploading and Indexing a Document
Postman Flow example
Steps:
Get GlobalSearch License
Request: GET Authentication and Licenses/Get License
Uses Basic Authentication using the postman
{{user}}
and{{password}}
variables (pulled from Postman Environment)
Upload File to Server
Request: POST Document Actions/Upload File To Server
Uses request body form-data to upload files
Note that you can add multiple files by adding more “file” keys to the form-data section.
Select the request and switch to the Body tab;
Index the document
Request: POST Document Actions/Import Document from WebPortalCache
Example Body of Request:
Running a search
Postman flow example:
See Searching/Run Search
In order to run a search you will need the following;
Database ID
Run Database/Get Database List and pick the most appropriate database from the returned list
Archive ID
Run Archives/Get Archives, pick the appropriate archive from the returned list
Search SecureId
Run Searching/Get Archive Searches to return a full list of searches for an archive, the "Hash" value in the returned information is the "SecureId" of the search.
Search Criteria information as needed
In the output of Searching/Get Archive Searches, each search will have a "Detail" object, each item is a search prompt, the "ID" value is the prompt id that will be used in the Search Critera
Note that the prompt ids will change if the search is modified/edited/updated.
The JSON document below is an excerpt of the information retrieved from the Searching/Get Archive Search request. Note that the “Detail” array will have a list of objects describing each Search Prompt. The “ID” key/value pair is the “Prompt Id”. The “FID” value is the GlobalSearch FieldID that the prompt will be compared against.
Once you have all of this information fill it out in the GlobalSearch Collection variables as desired.
For the "SearchCriteria" URL parameter, this is a JSON document that pairs Prompt IDs (retrieved from search description) with the search criteria.
When passed in via URL param as described the above will execute the search with "tom" as the only filter criteria for search prompt 1. Postman will handle URL escaping, if you are implementing outside of Postman you will have to take steps to ensure that the search values are properly escaped, if they are not you may recieve 404s instead of an error message.
Other Parameters for Searching/Run Search
Page - Mainly used by GlobalSearch Web/LAN to return a limited number of results in page like fashion
RecordsPerPage - The number of results to return
SecureId - The "Hash" of the search
count - Only returns the number of documents found, without information about the documents themselves
Moving a Document
See Document Actions/Copy Document and Document Actions/Move Document
In order to move a document you will need to know the following
DatabaseID - GlobalSearch Database ID
Run Database/Get Database List and pick the most appropriate database from the returned list
ArchiveID - GlobalSearch Archive ID
Run Archives/Get Archives, pick the appropriate database from the returned list
DocID - GlobalSearch Document ID
There are many ways this is obtained, typically via running a search
DestinationArchiveID - GlobalSearch Archive ID that you want to move/copy the document to
SecureID - A unique hash of the document
See Document Actions/Get Document Secure ID
Updating Index data on a Document
See Document Actions/Update Index Data
In order to update index data fro a document you will need to know the following, see previous sections for how to obtain these.
DatabaseID - GlobalSearch Database ID
ArchiveID - GlobalSearch Archive ID
DocID - GlobalSearch Document ID
SecureID - A unique hash of the document
Example Body of Request:
Below is an example of the Request body used for updating index data. The “ID” key value pair refers to the FieldID on the document that you want to update the data for. The “VAL” key/value pair is the value that you want to be updated.