The following is a list of API functions related to contents, media and tags.
Contents
createContent
Creates a content (to be included in a communication or a web page).
Returns the ID of the created content.
Datetime values and date values must be formatted using international settings of the user that is requesting the operation.
In order to create a content you have to define at least the field designerType as "giotto" and the proper magnewsType (e.g. "article", "link", etc; for more details see Content).
Then, because contents are organized in libraries, you need to define where to save the content: there is a library for each communication/journey/survey, a shared global content library, and therefore a content-private library where all children contents are stored (for a very advanced usage!). To save the content inside a communication you have to specify the field idnewsletter; to put the content inside a journey use the field idcampaign, whereas for a website-content just use the field idwebsite. By leaving all these fields empty the content will be stored in the shared global contents library.
Parameter | Type | Description |
---|---|---|
content | Content | The content to create. Supported Content properties:
|
options | List of <Option> |
Return values: String
Permissions: Manage contents
downloadContent
Returns a content, with format dependent on the type of content (e.g. an image will provide the content of the file, a file will return an HTML string).
The object Content contains the field contentType that corresponds to the MIME Type related to the content.
See createContent for a more detailed description.
Parameter | Type |
---|---|
idContent | String |
options | List of <Option> |
Return values: Content
Permissions: None (every content is always public)
deleteContent
Deletes a content so that it no longer appears in the lists and that if a user clicks to see the main body the page is not found.
Parameter | Type | Description |
---|---|---|
idContent | String | |
options | List of <Option> |
Return values: Void
Permissions: Manage contents
insertContentInNewsletter
Adds a content to a communication that can be modified with the Designer.
Parameter | Type | Description |
---|---|---|
idContent | String | |
idNewsletter | String | |
block | String | The HTML container where the content will be inserted |
position | String | Where to insert the content inside the container (block). Supported values: first, last, the index position |
format | String | Used to specify the content type to use to draw the content inside the document. Leave it empty or null in order to let the system choose automatically the content type |
Return values: Void
Permissions: Manage contents and manage communications of the journey
createContainerInNewsletter
Adds a container to a communication that can be modified with the Designer.
Parameter | Type | Description |
---|---|---|
idNewsletter | String | |
path | String | /idcontainer/#position. For example: /myContainer/#1 |
position | String | 'first' or 'last' |
contenttype | String | |
values | List of FieldValue |
Return values: Void
Permissions: Manage communications of the journey
updateContainerValuesInNewsletter
Updates a container filling with all the given values.
Parameter | Type | Description |
---|---|---|
idNewsletter | String | |
path | String | /idcontainer/#position. For example: /myContainer/#1 |
values | list of FieldValue |
Return values: Void
Permissions: Manage communications of the journey
clearContainerContentsInNewsletter
Clears a container.
Parameter | Type |
---|---|
idNewsletter | String |
path | String |
Return values: Void
Permissions: Manage communications of the journey
fillNewsletter
Inserts a list of content inside a communication using a mn:schemedef guide.
Parameter | Type |
---|---|
idNewsletter | String |
path | String |
schemename | String |
data | FillNewsletterData |
options | List of <Option> |
Return values: Void
Permissions: Manage communications of the journey and manage contents
getContentsInNewsletter
Returns the list of contents/s ID in the communication.
Note: to get the communication content in the SMS format you have to use getNewsletterDetails
Parameter | Type | Description |
---|---|---|
idNewsletter | String |
Return values: List of String
Permissions: Manage communications of the journey and manage contents
queryContents
Returns the list of the contents IDs that matches the given query.
To restrict the query to a specific library use option library; to set the context of the library set the value of the idnewsletter, idcampaign or idwebsite.
To execute queries by content fields you need to specify the contenttype option which selects the model for the contents.
Parameter | Type | Description |
---|---|---|
query | String | It only accepts queries with 'select *', it doesn't accept queries that specify field names. Query examples: SELECT * FROM CONTENTS WHERE name = 'mycontent' SELECT * FROM CONTENTS WHERE name LIKE 'myname' SELECT * FROM CONTENTS WHERE name LIKE '%mynameendwith' SELECT * FROM CONTENTS WHERE name LIKE '%mynamecontains%' ORDER BY lastmodificationdate LIMIT 10 SELECT * FROM CONTENTS WHERE template='mycustomtype' |
options | List of <Option> |
|
Return values: List of String
Permissions: Manage contents
Media
uploadMedia
Create a media (a file sources) for use in a communication or journey.
Note: this operation returns other media structure because the file name could be changed if the system finds another media with the same name in selected library.
Medias are organized in libraries, there is one library for each communication, for each journey, for each content and there is a global media library shared among all contexts.
Inside the Media structure you have to fill idnewsletter field in order to put the media inside the communication media library.
To insert a media in a journey media library, you have to fill the idcampaign field.
If you leave empty idnewsletter, idcampaign, idcontent and idwebsite fields the media will be put on the global media library.
To get the URL of a media you have to use the syntax [image:filename.gif from=newsletter]
, specifying the library to use in the from parameter (e.g. communication, journey, content or global).
To get the URL of a media that is not an image file type (gif, jpg, png) you have to use [redirect:file name=filename.js from=global]
To get the URL that counts the number of downloads of a media that is not an image file type (gif, jpg, png) you have to use [link:file name=filename.js from=global]
.
Parameter | Type | Description |
---|---|---|
media | Media | |
options | List of <Option> |
Return values: Media
Permissions: Manage contents
downloadMedia
Downloads info and contents of a media file.
Parameter | Type | Description |
---|---|---|
idmedia | String | |
options | List of <Option> |
|
Return values: Media
Permissions: None (every media is always public)
findMediaByName
Downloads info and contents of a media file.
Parameter | Type | Description |
---|---|---|
name | String | |
options | List of <Option> | Available options:
|
Return values: Media
Permissions: None (every media is always public)
Tags
getAllContentTags
Returns the description of all tags for defined contents.
Parameter | Type |
---|---|
options | List of <Option> |
Return values: List of MNContentTag
Permissions: None (every tag is always public)
createContentTag
Creates a tag for contents (Objects Properties).
Parameter | Type | Description |
---|---|---|
name | String | |
type | String | must be simple or empty |
values | List of String | |
options | List of <Option> |
Return values: MNContentTag
Permissions: Manage contents