create_attachment
imerit_ango.sdk.SDK.
create_attachment(project_id, attachments)
Add attachments to assets in a project—more on attachments and uploading them here.
Parameters
project_id: string
The unique identifier for the project. You can find the project ID in the user interface or retrieve it using the
list_projects
function.
attachments: List[dict]
List of attachments to attach to existing assets. Attachments are dictionaries containing information about the asset the attachment will be attached to, the type of attachment, and the content of the attachment.
Example attachment parameter with 3 attachments being attached to 2 assets:
attachments = [
{"externalId": "sample_image_1.png",
"attachments": [
{"type": "IMAGE", "value": "https://sample-attachment-image.jpg"},
{"type": "TEXT", "value": "Some sample text."}
]
},
{"externalId": "sample_image_2.png",
"attachments": [
{"type": "VIDEO", "value": "https://sample-attachment-video.jpg"}
]
}
]
In AWS S3, if your attachment URL does not contain region information, your attachments may not be visible. When using S3, please ensure the region information is contained in the URL right after the bucket name, like so:
https://bucket-name.s3.eu-central-1.amazonaws.com/filename.JPG?storageId=111bb111389ff80015f2b914
Returns:
output: dict
A dictionary containing the result of the operation.
Example
import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK
load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')
ango_sdk = SDK(api_key)
attachments = [{"externalId": "sample_image_1.png",
"attachments": [{"type": "IMAGE",
"value": "https://sample-attachment-image.jpg"},
{"type": "TEXT",
"value": "Some sample text."}]
},
{"externalId": "sample_image_2.png",
"attachments": [{"type": "VIDEO",
"value": "https://sample-attachment-video.jpg"}]
}]
ango_sdk.create_attachment(project_id, attachments)
Last updated