I'm trying to create assets using the Marketing Cloud PHP Fuel SDK, and I'm running into a problem where the assets are being created (as in, I can retrieve a list of assets and see the assets I've created) but all of the assets I create are being stored in what I presume is a hidden top-level folder called 'Portfolio'. This folder isn't viewable in the Marketing Cloud UI (and therefore neither are the assets).

I've tried setting the category ID as part of the call (see the dumped JSON below) but it's ignored. I'm assuming it's something either to do with business units, or perhaps some kind of permissions issue, but I'm slightly at a loss!

JSON body:

"description":"Here's a description4",

Output from call:

[status] => OK
    [mediaItem] => stdClass Object
            [mediaItemID] => <an id>
            [mediaTypeID] => 206
            [fileName] => TestFile1951593187.txt
            [customerKey] => <a key>
            [categoryID] => 3677
            [categoryType] => media
            [displayName] => TestFile1362398296.txt
            [description] => Here's a description4
            [createdDate] => 2020-03-20T02:58:50.1460251-06:00
            [modifiedDate] => 2020-03-20T02:58:50.1460251-06:00
            [cacheClearTime] => 0001-01-01T00:00:00
            [createdBy] => <an id number>
            [modifiedBy] => <an id number>
            [isUploaded] => 
            [active] => 1
            [fileSizeKB] => 0
            [thumbSizeKB] => 0
            [fileWidthPX] => 0
            [fileHeightPX] => 0
            [defaultIconURL] => 
            [fileURL] => http://<url>/TestFile1951593187.txt
            [thumbURL] => 
            [akamaiBaseURL] => http://<url>/lib/
            [ownerID] => 0
            [migrated] => 
            [classification] => Unknown
            [isGlobal] => 

In case it's useful, here's the relevant PHP code I'm using (amended only slightly from the Fuel SDK's sample scripts):

use FuelSdk\ET_Client;
use FuelSdk\ET_Asset;
$base64EncodedString = base64_encode("Test text file.");
$myclient = new ET_Client();

try {   

$postAsset = new ET_Asset();
$postAsset->authStub = $myclient;
$postAsset->props = array("fileName" => "TestFile" . rand() . ".txt", "mimeType" => "text/plain", "fileData" => $base64EncodedString, "displayName" => "TestFile" . rand() . ".txt", "customerKey" => md5(uniqid()), "description" => "Here's a description", "category" => array("ID" => 4940));
$postResponse = $postAsset->Post();
print_r('Post Status: '.($postResponse->status ? 'true' : 'false')."\n");
print 'Code: '.$postResponse->code."\n";
print 'Message: '.$postResponse->message."\n";
print 'Results Length: '. count($postResponse->results)."\n";
print 'Results: ' . "\n";
catch (Exception $e) {
    echo 'Caught exception: ',  $e->getMessage(), "\n";
  • This sounds like you are using the 'Classic' endpoint (SOAP API) which contains a top level folder named Portfolio. You want to utilize the Asset REST API to push to Content Builder – Gortonington Mar 20 '20 at 12:11
  • 1
    I don't think I'm using the SOAP API. I'm using the PHP Fuel SDK, specifically ET_Client/ET_Asset, which uses the REST API. If I comment out the 'baseSoapUrl' value in the config.php for the FUEL SDK, it still completes 'successfully' -- except in the wrong location. – Keith Fryer Mar 20 '20 at 12:25

It seems the PHP Fuel SDK is still internally configured to use the API for the ‘classic’ UI (I’m new to SFMC so not sure if this is correct). Changing the defined URI for the asset resource in the SDK fixed this problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.