1

I am getting an internal server error when trying to save an asset to the content library.

let options = {
  uri: '/asset/v1/content/assets',
  json: true,
  body: MCData
}

const RestClient = new FuelRest({auth: FuelAuthClient});
RestClient.post(options)
.then((result) => {
  console.dir(result);
})
.catch((error) => {
  console.dir(error);
})

The body of my request (MCData) is:

{
  "name":"Document 123",
  "assetType":{
    "name":"png",
    "id":28
  },
  "file":"data:image/png;base64, REST OF THE Encoded IMAGE HERE"
}

I can make a get request to the same endpoint (https://www.exacttargetapis.com/asset/v1/content/assets) and retrieve that I have no content (a correct response with a count of zero).

I am using the FuelSDK-Node-REST library. Error is

{ message: 'Internal Server Error',
 errorcode: 0,
 documentation: 'https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm' }
  • 1
    My gut feel (which is not an answer) is that you're missing some stuff...the data part of the body comes to mind. Make sure to go through the asset reference guide at developer.salesforce.com/docs/… – Timothy Mar 21 '18 at 13:53
1

So a stupidly simple solution that followed from looking at Timothy's link. I noticed the file in that link had no file type (which MC must be deriving from the Asset Type being created) so I split the Base64 string around the ',' to remove the data:image/png;base64, and retried with success.

|improve this answer|||||

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.