Documentation Index

Fetch the complete documentation index at: https://help.elaine.io/llms.txt

Use this file to discover all available pages before exploring further.

API reference: Content handling

Prev Next

 API reference: Content handling documents the function signatures, parameters, return values, and error behavior of the Elaine HTTP API.

Note

Function availability depends on the Elaine release and enabled features. Authenticate HTTP requests with an Elaine-issued Bearer JWT.

Function overview

integerapi_articleCreate ( string $content , string $subject = '' , bool $use_parser = true , string $mimetype = 'text/plain' , string $charset = 'utf-8' , bool $visible = true )
Creates a new article and returns its ID.
integerapi_compositionCreate ( string $subject , array $parts , bool $copyparts = false , bool $condition = false )
Creates a composition with the specified subject from the article transferred as ID array $parts.
integer|booleanapi_compositionImport ( string $subject , string $content , bool $rewrite_links = true , bool $insert_trackimage = true , string $base_url = '' , string $link_category = '' , string $charset = 'utf-8' )
Creates a new composition from the transferred subject and composition source code and returns its ID.
integerapi_compositionImportUrl ( string $url , string $subject , bool $rewrite_links = true , bool $insert_trackimage = true , string $base_url = '' , string $link_category = '' , string $charset = 'utf-8' )
Generates a mailing from the transferred URL.
arrayapi_getArticleDetails ( int $part_id )
Delivers an associative array with detailed information on a transferred article ID.
array|integerapi_getArticleList ( int $cat_id , int $show = 1 )
Delivers an array of all articles saved in the specified folder.
array|integerapi_getFolders ()
Delivers an array of the article folders created for the current tenant.
stringapi_userParseText ( string $text = '' , int $p_id )
Personalises the transferred text and returns it.

Functions

api_articleCreate

integer api_articleCreate( string $content , string $subject = '' , bool $use_parser = true , string $mimetype = 'text/plain' , string $charset = 'utf-8' , bool $visible = true )

Creates a new article and returns its ID. Additionally to (plain text or html) content, you can specify the name, mime type and charset encoding. If $use_parser is activated, the input text will be handled as with a classic ELAINE import, i.e. with link rewriting and track image integration, if required. The parameter $show controls if the part is also displayed in the ELAINE interface.

Parameters

string$contentContent for article
string$subject = ''Subject for article
bool$use_parser = trueParse the content
string$mimetype = 'text/plain'Mimetype of content
string$charset = 'utf-8'Charset of content
bool$visible = trueArticle visibility

Return Value

integerNew ID of article or error code


api_compositionCreate

integer api_compositionCreate( string $subject , array $parts , bool $copyparts = false , bool $condition = false )

Creates a composition with the specified subject from the article transferred as ID array $parts. If the parameter $copyparts is activated, the articles will also be copied to the article folder. If an array is transferred as parameter $condition, a condition term, which can be included in the composition, can be delivered for each transferred part (as array key).

Parameters

string$subjectSubject for composing
array$partsParts for composing
bool$copyparts = falseCopy or link?
bool$condition = falseMust be an array with part ids as Keys and the condition(as string) as value

Return Value

integerID of new composing

api_compositionImport

Creates a new composition from the transferred subject and composition source code and returns its ID. The source code must contain at least one part wrapped with a [part] tag.

Sample source code:

[part mime(html) id(0)]    <b> This is a HTML-sample code</b> [/part] [part mime(text) id(0)]    This is a plaintext sample [/part] [part mime(html) condition(c_gender=m) id(0)]    <i>This is a sample article with individualizing (condition).</i> [/part]

As the source code can be taken from the Elaine instance itself, parts may already contain ID information (as seen in the example). However, this will not be taken into account during the import and can be left out.

You can parametrise the import of content in the interactive import dialogue. You can specify, whether found links should automatically be replaced by tracking links, whether an image tracker should be inserted, whether relative links should be changed into absolute links by means of a base URL, whether a default link category is to be configured and in which charset you wish to provide content. Generally, we recommend to deliver content directly in the internally used charset UTF-8.

Parameters

string$subjectSubject of mail
string$contentContent of mail
bool$rewrite_links = trueBool wether the importer should automatically rewrite links into tracked links, default true
bool$insert_trackimage = trueBool wether to add a trackimage or not, default true
string$base_url = ''String basic url for relative urls
string$link_category = ''String tagname of the basic link category if not set already
string$charset = 'utf-8'String name of the charset to be used, default: automatic, checks for charset itself

Return Value

integer|booleanID of created newsletter or false


api_compositionImportUrl

Generates a mailing from the transferred URL. The function imports the source code from the given URL and performs according to the api_compositionImport().

Parameters

string$urlURL of the source to import
string$subjectSubject of mail
bool$rewrite_links = trueWether the importer should automatically rewrite links into tracked links, default true
bool$insert_trackimage = trueWether to add a trackimage or not, default true
string$base_url = ''Basic url for relative urls
string$link_category = ''Tagname of the basic link category if not set already
string$charset = 'utf-8'Name of the charset to be used, default: automatic, checks for charset itself

Return Value

integer$nl_id ID of created newsletter or false


api_getArticleDetails

array api_getArticleDetails( int $part_id )

Delivers an associative array with detailed information on a transferred article ID. The following information will be returned: 'id', 'title', 'content', 'mime', 'category', 'show', 'template'

Parameters

int$part_idArticle ID

Return Value

arrayDetails of the article


api_getArticleList

array|integer api_getArticleList( int $cat_id , int $show = 1 )

Delivers an array of all articles saved in the specified folder. Articles on the main layer can be called up by entering the folder ID 0. Optionally, you can access articles, whose output is suppressed in the interface ($show=0: only hidden, $show=2: visible and hidden). An array will be returned with elements as associative arrays with the keys 'id', 'title', 'content' and 'mime'.

Parameters

int$cat_idHolds the id of the category to show, 0 means no category
int$show = 11 means just show parts that are shown in the frontend; 0 means get hidden parts, 2 means get shown and hidden parts

Return Value

array|integerArray with every part and information to each part (id, title, content, mime)


array|integer api_getFolders ()

Delivers an array of the article folders created for the current tenant. The individual array elements are associative arrays with the keys 'id' and 'name' of the relevant folder.

Return Value

array|integerFolders of current tenant


api_userParseText

string api_userParseText( string $text = '' , int $p_id )

Personalises the transferred text and returns it. Replaces tags (e.g. [c_email]), but not links, i.e. tracking based on this text is not possible.

Parameters

string$text = ''Text to parse
int$p_idELAINE profile ID

Return Value

stringParsed text