Date File Upload API

This API endpoint is intended to be used to upload large files/artifacts for processing within the Opsera backend workflow.

Required Headers

  1. Authorization: Bearer <your_auth_token>

  2. Content-Type: application/json

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

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

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

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

Opsera API Token Generation

From within the Opsera portal, follow these steps to generate an API token if you don't already have one.

  1. Login to the Opsera portal.

  2. Access User Profile: Click on your user avatar or profile picture at the top-right corner of the dashboard.

  3. Navigate to API Tokens: Select "API Tokens" or "Personal Access Tokens" from the profile settings menu.

  4. Create a New API Token: Click on the "Create New Token" button and provide a name for the token.

  5. Define Permissions: Choose the appropriate permissions or scopes for the token.

  6. Generate and Save the Token: Click "Generate Token" and securely store the displayed token.

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. Calculate the MD5 hash and file size of the original JSON file:

   original_md5=$(md5sum data.json | cut -d ' ' -f 1)    original_size=$(wc -c < data.json)

 

  1. Use the following curl command to upload the file (replace placeholders with your actual values):

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

{   "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


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.