Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents
stylenone

Required Headers

...

  1. Authorization: Bearer <your_auth_token>

  2. Content-Type: application/json

  3. Content-Encoding: gzip

  4. X-File-Content-Classification: Insights.UnityProjects

  5. X-File-Content-Length: <original_file_size_in_bytes>

  6. X-File-Content-MD5: <MD5_hash_of_original_file>

  7. X-File-Name: <original_file_name.json>

Valid Header Values

...

  • X-File-Content-Classification: Insights.UnityProjects - A classification to help us track the source of this data.

  • X-File-Content-Length: A positive integer representing the size of the original (uncompressed) JSON file in bytes

  • X-File-Content-MD5: The MD5 hash of the original (uncompressed) JSON file

  • X-File-Name: The original filename of your JSON file

...

For more information please see: https://docs.opsera.io/api-platform-and-integration/opsera-api-platform/personal-access-tokens

Steps to Test Using

...

cURL

  1. Prepare your JSON file (e.g., "data.json").

  2. Compress the file using gzip:

...

Code Block
bash
curl -X POST "https://api.honeywell-sandbox.opsera.io/data-migration-file/data/upload" \
     -H "Authorization: Bearer YOUR_AUTH_TOKEN" \
     -H "Content-Type: application/json" \
     -H "Content-Encoding: gzip" \
     -H "X-File-Content-Classification: Insights.UnityProjects" \
     -H "X-File-Content-Length: $original_size" \
     -H "X-File-Content-MD5: $original_md5" \
     -H "X-File-Name: data.json" \
     --data-binary "@data.json.gz"

Expected API Response

...


Upon successful upload, the API will return a JSON object with the following structure:

Code Block
{
  "id": "string",
  "contentLength": number,
  "contentMD5": "string"
}

Description of Response Attributes

...

  • id: A string representing the unique identifier (artifactId) assigned to the uploaded file. This ID can be used for future references or operations related to this file.

  • contentLength: A number indicating the size of the original (uncompressed) file in bytes. This should match the value you provided in the X-File-Content-Length header.

  • contentMD5: A string containing the MD5 hash of the original (uncompressed) file. This should match the value you provided in the X-File-Content-MD5 header.

Example Response

...

Code Block
❯ export AUTH_TOKEN="{auth token}"

❯ ./testGzippedJSONFileUpload.sh
Original JSON file size:  17934041
Original JSON file MD5 hash: d5ce63f2310d40ce14d7044764725e1a
Gzipped file size:   970511
Gzipped file MD5 hash: 1a0f877a9efb97d010d52155e0dd3778
Sending file: HCE-full.json.gz
Content-Length:   970511
X-File-Content-Length:  17934041
X-File-Content-MD5: d5ce63f2310d40ce14d7044764725e1a
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  947k  100   106  100  947k     40   363k  0:00:02  0:00:02 --:--:--  363k
Response status code: 0
Response body:
{"id":"66cd1b866f255a5904fffed9","contentLength":17934041,"contentMD5":"d5ce63f2310d40ce14d7044764725e1a"}
ID: 66cd1b866f255a5904fffed9
Expected File Size: 17934041
Expected MD5: d5ce63f2310d40ce14d7044764725e1a
Upload successful!


This response confirms that your file was successfully uploaded and provides you with the necessary information to verify the upload and reference the file in the future.

Postman Example

...


To test using Postman, you can import the following cURL command:

Code Block
curl --location 'https://api.honeywell-sandbox.opsera.io/data-migration-file/data/upload' \
--header 'Authorization: Bearer YOUR_AUTH_TOKEN' \
--header 'Content-Type: application/json' \
--header 'Content-Encoding: gzip' \
--header 'X-File-Content-Classification: Insights.UnityProjects' \
--header 'X-File-Content-Length: ORIGINAL_FILE_SIZE' \
--header 'X-File-Content-MD5: ORIGINAL_FILE_MD5' \
--header 'X-File-Name: data.json' \
--data '@/path/to/your/data.json.gz'

...

To import this into Postman:

  1. Open Postman

  2. Click on "Import" in the top left corner

  3. Choose the "Raw text" tab

  4. Paste the curl command above

  5. Click "Continue" and then "Import"

  6. Update the placeholder values with your actual data before sending the request

...