Specifying an existing assets folder on AJAX post for "addAssets""

So I am successfully uploading to assets folder using:
formData.append(“files[]”, file);

ahead of attaching it to data in an ajax call, but I am wondering if I am able to specify an existing assets folder. I can, after the upload, log in to Cockpit and go to “Edit Asset” and click the “Folder” option and select a folder from there, but anyway to do this against the API?

Tried including another key value in the formData, ie.:
formData.append(“folder”, “name_of_folder”);

but thats not it. Any help?

Cheers, Aaron.

Try it with meta[folder], folder_id instead.

Thanks for that, its a lot of help! My issue now is that I can’t figure out how / where to find the id of the folder. I was using the name I gave it but of course that’s not what it needs. There appears to be no “Show JSON” button in the asset UI and I cant find mention in the docs or any of the JSON I get back from my calls.

Any idea how I can find what the ID of any given folder is? Is there an endpoint which reveals it?

Sorry to be a pain!


O, I see. There is no rest api endpoint yet to list folders.

If you are logged in, you can call the url /assetsmanager/_folders in your browser to list all folders as a json response.