Hello!
I’m trying to create a folder using the method in your documentation for creating an asset. However I keep running into 422 errors, telling me its an invalid argument. Even using your own system to try out api calls using your built in python requests system I couldn’t make it go through. Is there something I am missing in order to get it to pop through?
Thanks for the help
Can you share the body of the POST request you’re using to create the folder? Without that it’s hard to know what’s going wrong.
Sure, this is the bit of code I’ve been using to create the folder:
url = f"https://api.frame.io/v2/assets/{frameio_id}/children"
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {access_token}'
}
payload = {
"name": "Internal",
"type": "folder"
}
create_folder = requests.post(url, json=payload, headers=headers)
The frameio_id is the project id, and access token being the dev token.
I see your problem, you can’t pass the project_id
in the path parameter, you need to pass the root_asset_id
for the Project which is the root folder of said project.
If you’re using the web app, you can get the root_asset_id
for the project by clicking the “Media” tab in the Project’s header, which will update the URL in the browser, changing it from
https://app.frame.io/projects/1dc7b623-e5bb-42e0-bcb1-0f0ba3b2a63e
→ https://app.frame.io/projects/1dc7b623-e5bb-42e0-bcb1-0f0ba3b2a63e/d164cdb0-50ed-4640-98e1-0f4e57b1b2ff
.
The part after the last /
: d164cdb0-50ed-4640-98e1-0f4e57b1b2ff
would be the root asset id of that particular project.
Ah I see now, that makes sense. For some reason that never occurred to me. Thanks for the assistance!
Glad to hear that fixed your issue! Happy coding