Smart M.App discussions

Looking for answers in regards to M.Apps, M.App Exchange or M.App Studio? Smart M.App Tech Discussion board is where you can search, ask your questions and assist others by sharing your knowledge. Join the conversation, connect, contribute and share.
Showing results for 
Search instead for 
Do you mean 
Frequent Contributor
Posts: 107
Registered: ‎10-16-2015
Accepted Solution

Upload image using Foundation API fails



I've been trying to upload images using the Foundation API. These are the steps:



// first obtain an uploadId
ajax('api/v1/uploads', 'POST', { processData: false, contentType: 'application/json', data: JSON.stringify({ parentFolderId:, generateThumbnail: true, uploadStoreType: 'S3', subFolder: null }) }).then(function (response) { var uploadId =;
// upload the files ajax(`api/v1/uploads/${uploadId}/files`, 'POST', { data: formData, contentType: false, processData: false }).then(function (result) {
// finalize the upload ajax(`api/v1/uploads/${uploadId}/complete`, 'PUT').then(function () { resolve(result); }) }) })


When I look into the content of the /files/ request I see my file with the correct contentType.

The resulting file in the Chest appears to be empty though. When I download I get an empty zip.


Well, I thought, maybe the formData is constructed wrong? So I've used the API Console to try the same thing:

  • obtain a uploadId
  • upload the file(s)
  • finalize the upload

The result was the same: There is a file, but when I download it, I get an empty ZIP file.


When I look at the Chest itself and upload the same file I see a completely different set of requests:

  • obtain an uploadId
  • some calls to Amazon
  • finalize the upload

So, what am I doing wrong?


Frequent Contributor
Posts: 107
Registered: ‎10-16-2015

Re: Upload image using Foundation API fails

Ah, it turns out I needed to use 'Direct' for uploadStoreType.