Issue with JS API setContentOfEditableFileAsset function


(Jamie Smith) #1

We recently upgraded from 5.2.8 to 5.4.0.1 and there appears to be an issue with the JavaScript API function setContentOfEditableFileAsset(). I run the function below but an error is returned:

Function:

FOO.api.setContentOfEditableFileAsset({
    'asset_id': 123456,
    'content': 'The content here',
    'dataCallback': function(data) {
        console.log(data);
    }
});

Returned error:

error: "The setContentOfEditableFileAsset function must be activated"
errorCode: "badRequest"
  • I have locks on the asset
  • “Set File Content” is set to Yes in the API asset Details screen in the Matrix admin interface. I’ve tried changing to No, saving, then back to Yes but to no avail
  • setContentOfEditableFileAsset() is available to call in JavaScript; it looks like the issue is with running the related functionality on the server

Can anyone suggest what might be causing the problem?

Cheers in advance.

Jamie


(Jamie Smith) #2

Can I ask whether anyone is currently on 5.4.0.1 and using setContentOfEditableFileAsset() successfully? I’m trying to determine whether the problem is caused by a bug or something else.

One key piece of functionality on our site depends on setting the contents of a file so I’m keen to get to the bottom of the issue.


(Bart Banda) #3

Hey Jamie, Haven’t had a chance to test this yet, will try tomorrow.

Can you try using https://matrix.squiz.net/manuals/web-services/chapters/javascript-api#updateFileAssetContent in the meantime? Should hopefully be able to solve the same issue?


(Bart Banda) #4

Tested this on the latest 5.4, and I also get the same error. Have reported it in Squizmap as a bug
https://squizmap.squiz.net/matrix/10484


(Jamie Smith) #5

Many thanks, Bart. Will try converting the data to base64 and use updateFileAssetContent().