menu
announcement

Spectrum is now read-only. Learn more about the decision in our official announcement.

Frame.io Developers

Frame.io is a video review and collaboration platform. Share video projects with your team and clients for fast feedback and approval. Use Frame.io's API to add custom features to your workflow!

Channels
Team

Find all assets older than a month

May 14, 2021 at 2:13am

Find all assets older than a month

May 14, 2021 at 2:13am (Edited 9 months ago)
I'm sorry I can't speak english well. I want find asset using API.
And command in windows 10 cmd tool.
Like this
curl -i -X GET \
https://api.frame.io/v2/search/library \
-H "Authorization: Bearer <MyToken>" \
-H "Content-Type: application/json" \
-d "{ \
"account_id": "My Account ID", \
"filter": { \
"inserted_at": { \
"op": "lte", \
"value": "2021-04-13T04:00:00.000Z" \
}\
}"
I can't get any thing.
I got empty list
I use just "account_id"
curl -d "{"account_id": "my account id"}", -H "Content-Type: application/json" -H "Authorization: Bearer My_Token" -X GET https://api.frame.io/v2/search/library
I got empty list also
And I use python
import requests
url = "https://api.frame.io/v2/search/library"
query = {
"account_id": "my account id",
"filter" : {
"inserted_at": {
"op" : "lte",
"value" : "2020-05-14T03:59:59.999Z"
}
}
}
headers = {"Authorization": "Bearer {}".format(TOKEN)}
response = requests.get(url, headers=headers, params=query)
data = response.json()
print(data)
I got error
{'code': 500, 'errors': [{'code': 500, 'detail': 'There was a problem with your request', 'status': 500, 'title': 'Something went wrong'}], 'message': 'Something went wrong'}
How to use filter parameter in python?
I don't know how to write parameters.
Please example python code for me.
Thankyou

May 14, 2021 at 2:16am
Hi there (vptd)! You were actually super close, I think you just need to switch from a GET request to a POST request and it should work.
query = {
"account_id": account_id,
"page": 1,
"page_size": 50,
"sort": "-inserted_at",
"filter": {
"updated_at": {
"op": "lte",
"value": '2021-04-13T04:00:01.000000+00:00'
}
}
}
This is a rough example for what you'll want to turn your query into so that you can do pagination.
Edited
Thank you (jeff-hodges). I change get -> post and copy your json and run command. I also got same error. Error 'code' : 500
Edited
Sorry I found mistake in headers. Headers dictionary don't have "Content-Type". I rewrite headers but I can't get data at "https://api.frame.io/v2/search/library" I can get data at "https://api.frame.io/v2/search/assets" But assets require "project_id". I want all asset every teams, projects. I think library possible this. But I can't get any data.
Edited

May 14, 2021 at 5:37pm
Try this query which should grab assets from across your entire account:
{
"account_id": "{{account_id}}",
"page_size": 50,
"page": 1,
"filter": {
"inserted_at": {
"op": "lte",
"value": "2021-04-14T00:01:01.999Z"
},
"type": {
"op": "eq",
"value": "file"
}
},
"sort": "inserted_at"
}
The key thing I added was the type key using the operator eq, and a value of file in order to only return assets.