Mautic Community Forums

Create Asset REST API Example

https://developer.mautic.org/#create-asset

I’m desperate for an example where user POSTs the file, and the asset is returned.

The docs say the arguments are title/ storageLocation/ file.
Using postman – I can attach a file, but receive a 400: “File was not found in the asset directory.”.
I’m trying to upload the file, not reference an existing one :confused:

Hi @nacmonad,
I was facing the same issue and found a work around for it.
You will first need to upload the file in assets or images directory using files endpoint.
Once the file is uploaded you will get the file name in response which you can use in next call for creating new asset using assets endpoint.

1 Like