Update Asset REST API Asset Not found error


I’m trying to use the Update Asset REST API to update an .json file that exists only in my dev branch for now. But all I get in response is a 404 error with the content “{“error”:“Asset not found”}”

I’m using the doc found in Assets - Update asset | PlayCanvas Developer Site

I assume I’m getting this error because it doesn’t exists in main yet. Although in the docs there is no mention regarding specifing a branchId, I found some posts here in the forum mentioning it, so I tried to use it, but the error remains the same.

Also, here’s a print of the asset I’m trying to update

Here’s the cURL I’m currently trying to use.

curl -H "Authorization: Bearer <Token>" -X PUT -F 'name=./Configurations/env.json' -F 'branchId=e345ff75-523f-44a8-b240-4643c84007b9' -F 'file=env.json' "https://playcanvas.com/api/assets/167021433" --ssl-no-revoke

What am I doing wrong here?

Just found it. It was missing an @ in the file parameter and the name parameter should be only the name of the file, without any kind of path.

curl -H "Authorization: Bearer <Token>" -X PUT -F 'name=env.json' -F 'branchId=e345ff75-523f-44a8-b240-4643c84007b9' -F 'file=@env.json' "https://playcanvas.com/api/assets/167021433" --ssl-no-revoke

Anyhow, the docs should be updated with the name and branchId parameters.