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:
{
"fileName":"TestFile1529838321.txt",
"mimeType":"text\/plain",
"fileData":"S2VpdGgncyB0ZXN0IHRleHQgZmlsZTQu",
"displayName":"TestFile1223247811.txt",
"customerKey":"<key>",
"description":"Here's a description4",
"category":{"ID":4940}
}
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";
print_r($postResponse->results);
}
catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}