Looks like this:I think your payload structure is the issue.
req.postData = String(payload);
If you need to update other properties, retrieve a single asset using a GET on the same route -- and use that structure.
should beSomething like this will work:
req.postData = Stringify(payload);
<script runat="server" language="JavaScript">
Platform.Load("core", "1");
var assetId = 766569
var restbase = "https://mc-zzz.rest.marketingcloudapis.com"
var url = restbase + '/asset/v1/content/assets/' + assetId;
var authToken = ""
var payload = {
"content": "<!-- whoops2 -->"
}
Write("<br>url: " + url)
var req = new Script.Util.HttpRequest(url);
req.emptyContentHandling = 0;
req.retries = 2;
req.continueOnError = true;
req.contentType = "application/json"
req.setHeader("Authorization", "Bearer " + authToken);
req.method = "PATCH";
req.postData = Stringify(payload);
try {
var resp = req.send();
var resultStr = String(resp.content);
Write("<br>resultStr: " + resultStr)
var resultJSON = Platform.Function.ParseJSON(resultStr);
Write("<br>resultJSON: " + Stringify(resultJSON))
} catch(e) {
Write("<br>e: " + Stringify(e))
}
</script>