Assets API
Page Contents
- Images and Files#
- List contents#
- Uploading a resource#
- Updating a resource#
- Deleting a resource#
- Extensions#
- Uploading an extension#
- Updating an extension#
- Templates#
- List contents#
- Uploading a template#
- Updating a template#
- Committing a template#
- Contextual Schemas#
- Uploading a schema#
- Updating a schema#
- Webapps#
- Uploading a webapp#
- Updating a webapp#
The Assets API allows you to upload assets using our public api.
Images and Files
List contents
This will list the items and folders at the specified location.
GET /assets/resources/list
Optional: ?folder={folderName}
Response
[
{
"name": "Files and Resources",
"isFolder": true
},
{
"name": "Images",
"isFolder": true
},
{
"name": "logo.png",
"isFolder": false,
"referenced": true
}
]
Uploading a resource
Uploading a new resource. This operation will fail if the item already exists in the given location.
POST /assets/resources -F "file=@image.png"
Optional: -F "folder=Campaigns/Images"
Updating a resource
Updating a resource. This operation will either create or update the item if it exists in the given location.
PUT /assets/resources -F "file=@image.png" -F "folder=Campaigns/Images"
Deleting a resource
Deleting a resource. This operation will delete the item if it exists in the given location. The operation will fail if the item is referenced.
DELETE /assets/resources -F "file=images/Campaigns/image.png"
Extensions
Uploading an extension
Uploading a new resource. This operation will fail if the item already exists in the given location.
POST /assets/extensions -F "file=@extension.js" -F "type=step"
Optional: -F "folder=Automations"
Types must be one of the following:
- step
- condition
- http
- monitor
Updating an extension
Updating a resource. This operation updates the item if it exists in the given location. Please note, the operation will fail if the item does not exist at the given location.
PUT /assets/extensions -F "file=@extension.js" -F "folder=Automations"
Templates
List contents
This will list the items and folders at the specified location.
GET /assets/templates/list
Optional: ?folder={folderName}
[
{
"name": "Transactional",
"isFolder": true,
"referenced": false
},
{
"name": "default.html",
"isFolder": false,
"referenced": false
}
]
Uploading a template
Uploading a new template. This operation will fail if the item already exists in the given location.
POST /assets/templates -F "file=@template.html"
Optional: -F "folder=email/automations"
Updating a template
Updating a template. This operation will either create or update the item if it exists in the given location.
PUT /assets/templates -F "file=@template.html" -F "folder=email/automations"
Committing a template
Committing a template. This operation will commit the item if it exists in the given location.
POST /assets/templates/:commit -F "file=template.html" -F "folder=email/automations"
Contextual Schemas
Uploading a schema
Uploading a new schema. This operation will fail if the item already exists in the given location.
POST /assets/contexts -F "file=@schema.json"
Updating a schema
Updating a schema. This operation will either create or update the item if it exists in the given location.
PUT /assets/contexts -F "file=@schema.json"
Webapps
Uploading a webapp
Uploading a new webapp. This operation will fail if the item already exists in the given location.
A .zip archive must passed as the file form value. Please note – the name of the webapp will be the folder name, not the name of the .zip archive.
webapp
- index.jsp
- receipt.jsp
- style.css
- images
- logo.png
POST /assets/webapps -F "file=@webapp.zip"
Updating a webapp
Updating a webapp. This operation will either create or update the item if it exists in the given location.
PUT /assets/webapps -F "file=@webapp.zip"