[SOLVED] Uploading assets on a single branch with REST API

Hi,

This is not actually a valid request, in order to update an asset you would need to do something like this instead:

var updateBuildSettings = request({
        uri: `https://playcanvas.com/api/assets/${configuration.buildSettingsAssetId}`,
        method: 'PUT',
        headers: {
            "Authorization": `Bearer ${configuration.bearer}`
        },
});

let form = updateBuildSettings.form();
 form.append("name", "" + filePath);
 form.append("branchId", "e9150c63-9a1f-4c33-b95d-10647ed855e1");
 form.append("file", JSON.stringify(settings), {
     filename: filePath,
     contentType: "application/json"
 });
3 Likes