Is it possible to get specific date file using binary file API's

Hi Team,
I am using Binary files API to store my data in cumulocity.

Is there is any way to get all data file stored in specific time period?

Thanks,
Himanshu Agarwal

Hi,

Inventory binaries always com with a metadata managed object. You cannot modify or download binaries through this managed object but you can query for it and then use it to select the desired binaries. In a second step you can download the binaries by ID via binaries API.

These metadata objects contain a lastUpdated timestamp that is set on server side when the binary file is uploaded or overridden. You can use inventory filter queries (Cumulocity IoT - OpenAPI) on this. If you query as follows, you’ll receive all binary metadata objects uploaded in April:

{{url}}/inventory/managedObjects?query=has(c8y_IsBinary) and lastUpdated.date gt '2021-04-01T00:00:00.00Z' and lastUpdated.date lt '2021-05-01T00:00:00.000Z'

Please keep in mind that url encoding the filter query properly is important.

BR,
Philipp

Hi Philipp_Emmel,

First of all thanks for the help!!!

Is I am doing ant thing wrong in below api?
https://solenis.us.cumulocity.com/inventory/binaries?query=lastUpdated.date%20gt%20’2021-04-29T10:50:52.113Z’%20and%20lastUpdated.date%20lt%20’2021-05-05T00:00:00.000Z’ and owner ‘HAgarwal@Solenis.com’

Thanks,
Himanshu Agarwal

You are sending the your query to the wrong context path. Please exchange /inventory/binaries with /inventory/managedObjects as described in my initial answer.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.