1

REST API Content builder updating assets results in 404 I'm trying to migrate to REST API and according to SFMC documentation in order to update of an asset using PATCH I should use https://my_sub_domain.rest.marketingcloudapis.com/asset/v1/content/assets/{id}. However, all requests end with

1string(747) "HTTP/1.1 404 Not Found x-mashery-message-id: 8c94a90d-ba59-4c88-9dd8-0e8be18f2b8c x-mashery-responder: 07-rt06 strict-transport-security: max-age=15552000; preload Content-Security-Policy: upgrade-insecure-requests x-xss-protection: 1; mode=block x-frame-options: DENY x-content-type-options: nosniff cache-control: no-cache, must-revalidate, max-age=0, no-store, private Referrer-Policy: strict-origin-when-cross-origin Vary: Origin, X-HTTP-Method-Override Content-Type: application/json; charset=utf-8 Content-Length: 147 Date: Mon, 04 May 2020 21:53:38 GMT Connection: keep-alive {"documentation":"https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm","errorcode":404,"message":"Not Found"}"

JSon request

[{"name":"Test","assetType":{"id":"4963","name":"Test"},"views":{"subjectline":{"content":"test subject"},"html":{"content":"test content"}}}]

My code:

    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Authorization: Bearer ' . $token ));
curl_setopt($ch, CURLOPT_HEADER, 1);   
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$result = curl_exec($ch);

What do I miss?

Note: I'm able to retrieve the same asset with no issues

9
  • Did you put the ID in the URL, or literally use {id}?
    – sfdcfox
    Commented May 5, 2020 at 16:22
  • 1
    404 on this endpoint means the Asset was not found so my guess is that either you didn't add the Id (as per sfdcfox suggestion) or the Id doesnt exist within the Business Unit you are calling (try doing a get call on the same asset Id to see if you can find it)
    – Doug
    Commented May 5, 2020 at 16:26
  • @sfdcfox yes I do
    – Joseph
    Commented May 5, 2020 at 16:33
  • @Doug asset does exist, I'm able to retrieve it without any issues
    – Joseph
    Commented May 5, 2020 at 16:33
  • 1
    Your payload seems to be an array. Should just be the object. Commented May 5, 2020 at 19:33

0

You must log in to answer this question.

Browse other questions tagged .