Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel7
Note

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.

Initial Configuration

Download and import postman collection below;

...

Info

Using different environments in this manner allows you to quickly switch between users and GlobalSearch Servers. Note that you may have clear Postman cookies!

note

Any requests to delete GlobalSearch Objects (like database, archives, fields, lists, tables, documents, etc) will happen instantly and cannot be reversed. Use with care and consideration.

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.

...

Info

Any variable used by a request in a flow if not retrieved from the flow itself is pulled from the Postman GlobalSearch Collection variables

...

Steps:

Get 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/Upload File to Server"

    • 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:

    Code Block
    languagejson
    {"Index":1, "RawData":base64endcodedfilecontent, "JobID":jobid}
    • 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: https://www.base64encode.org/

      • 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.

If you wanted to upload in more than one chunk repeat this request (Upload File Chunk) with the next sequential chunk, being sure to increment the “Index” value in the Body of the request. Keeping the index values in order is important because this is how GlobalSearch will stitch the document back together.

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:
Code Block
languagejson
{
    "fields": [
        {
            "name": FieldID,
            "value": IndexFieldValue
        }
    ],
    "files":[
        {"name":WebPortalCacheFilename}
    ]
}
  • 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

Index the document

  • Request: POST “Document Actions/Import Document from WebPortalCache”

Example Body of Request:
Code Block
languagejson
{
    "fields": [
        {
            "name": FieldID,
            "value": IndexFieldValue
        }
    ],
    "files":[
        {"name":WebPortalCacheFilename}
    ]
}

...