Skip to main content

AddBlob

Add a user-defined blob object, and properties associated with the new object. A "blob" is a binary array that is treated as generic object file in ApertureDB.

A binary blob must be provided in the array of blobs or you can provide a url where the blob is.

Parameters

  • [optional] _ref: reference to be used within the transaction.
  • [optional] url: Provide a valid URL instead of passing a blob.
  • [optional] properties
  • [optional] if_not_found
  • [optional] connect

Details

properties are key-value pairs associated with the entity. Check properties for more details.

if_not_found can be used to turn this command into "conditional add". Check if_not_found for more details.

connect can be used to create a connection between the added object and other object(s). Check connect for more details.

Instead of passing a blob to this command, if you would like to add a blob without moving it away from a remote storage location such as a cloud bucket that it currently is present in, you can specify a valid URL to that blob.

An object pointed to by the url can be modified outside of the scope of the server. It might also be subject to a retention policy as determined by the storage target policies. When accessing this object through a Find* command, appropriate error will be returned if the object is no longer accessible.

Examples

Add a "Blob" representing an audio file using AddBlob command:


[{
"AddBlob": {
"properties": {
"type": "audio",
"sample_f_Hz": 44000,
"year": 2021
}
}
}]

A blob must be passed together with the JSON Query.

Successful response:


[{
"AddBlob": {
"status": 0
}
}]

Conditionally add a "blob" if the id is not already registered:


[{
"AddBlob": {
"if_not_found": {
"id": ["==", 44]
},
"properties": {
"type": "audio",
"sample_f_Hz": 44000,
"id": 44
}
}
}]

A blob must be passed together with the JSON Query.

Successful response:


[{
"AddBlob": {
"status": 0
}
}]

Conditionally add a "blob" if the id is not already present, add a "Recording" event, and create a connection between the "Blob" and the "Recording":


[{
"AddEntity": {
"_ref": 1,
"class": "Recording",
"properties": {
"start": {
"_date": "Mon Aug 7 10:59:24 PDT 2017"
},
"end": {
"_date": "Mon Aug 7 12:59:24 PDT 2017"
}
}
}
}, {
"AddBlob": {
"if_not_found": {
"id": ["==", 4444]
},
"properties": {
"type": "audio",
"sample_f_Hz": 44000,
"id": 4444
},
"connect": {
"ref": 1,
"class": "taken_in_session"
},
"url": "s3://aperturedb-s3-api-testing-0/sample_config.log"
}
}]

Successful response:


[{
"AddEntity": {
"status": 0
}
}, {
"AddBlob": {
"status": 0
}
}]