API Reference: Media.Upload
Uploads image to media gallery and makes it ready to be used in campaigns.
Input Parameters
Following parameters are required by this command:
- APIKey
Your user account API key. You can learn your API key in your Sendloop area > Manage Account section - Command
For subscribing an email address, you should set this parameter to 'Media.Upload' - MediaData Base64 encoded image file
- MediaType
'image/gif', 'image/jpeg' or any other supported image type - Tags
You can tag your image for future reference
Output
Sendloop will return some information about the request status. Sendloop always return in XML-RPC format. Below, you can see the list of all available codes and messages which can be returned by this command:
Error Codes and Messages:
One of the following error messages will be returned if any error occurs:
- #1
Connection type is not compatible - #2
Invalid API key or user account is not available - #9
Media exceeds maximum allowed size limit
Success Message
Success message will include the following three parameters:
- Status
'Completed' will be returned - MediaID
The ID number of new media
Examples
We provided examples in all three accepted messaging formats. Bold texts means data that needs to be replaced by you.
HTTP-POST Example
Input:
POST /api/index.php HTTP/1.1 Host: yoursubdomain.sendloop.com Content-Type: application/x-www-form-urlencoded FormValue_APIKey=YourAPIKeyHere&FormValue_Command=Media.Upload&
FormValue_MediaData=base64 encoded image file&FormValue_MediaType=image/gif&
FormValue_Tags=Example%20Tag&
HTTP-GET Example
Even this command accepts HTTP-GET method, we strongly recommend you to use HTTP-POST or XML-RPC methods
GET /api/index.php?APIKey=YourAPIKeyHere&Command=Media.Upload&
MediaData=base64 encoded image file&MediaType=image/gif&
Tags=Example%20Tag HTTP/1.1 Host: yoursubdomain.sendloop.com
XML-RPC Example
To connect Sendloop API through XML-RPC messaging format, you will need to pass XML-RPC code via HTTP-POST or HTTP-GET method:
XML-RPC connection via HTTP-POST:
POST /api/index.php HTTP/1.1 Host: yoursubdomain.sendloop.com Content-Type: application/x-www-form-urlencoded FormValue_Message=<<<The following XML structure must be inserted here with URL
encoded structure>>> <Entry> <Message> <APIKey>YourAPIKeyHere</APIKey> <Command>Media.Upload</Command> <MediaData>base64 encoded image file</MediaData> <MediaType>image/gif</MediaType> <Tags>Example Tag</Tags> </Message> </Entry>
XML-RPC connection via HTTP-GET:
GET /api/index.php?FormValue_Message=<<<The following XML structure must be
inserted here with URL encoded structure>>> HTTP/1.1 Host: yoursubdomain.sendloop.com <Entry> <Message> <APIKey>YourAPIKeyHere</APIKey> <Command>Media.Upload</Command> <MediaData>base64 encoded image file</MediaData> <MediaType>image/gif</MediaType> <Tags>Example Tag</Tags> </Message> </Entry>
Error Output Example
<value> <struct> <member> <name>APIError</name> <value><string>Invalid API key or user account is not available</string></value> </member> <member> <name>APIErrorCode</name> <value><string>2</string></value> </member> </struct> </value>
Success Output Example
<value> <struct> <member> <name>Status</name> <value><string>Completed</string></value> </member> <member> <name>MediaID</name> <value><string>ID number of the uploaded image</string></value> </member> </struct> </value>
Campaign Functions
Subscriber List Functions
Subscriber Custom Field Functions
Subscriber List Segment Functions
Subscriber List Integration Functions
Subscriber Functions
- Subscriber.Add
- Subscriber.Get
- Subscribers.Get
- Subscriber.Update
- Subscriber.Delete
- Subscriber.Unsubscribe
Report Functions
- Report.Campaign.Advisory
- Report.Campaign.EmailPath
- Report.Campaign.OpensOverall
- Report.Campaign.OpensDetail
- Report.Campaign.ClicksOverall
- Report.Campaign.ClicksDetail
- Report.Campaign.UnsubscriptionsOverall
- Report.Campaign.UnsubscriptionsDetail
- Report.Campaign.BrowserViewsOverall
- Report.Campaign.BrowserViewsDetail
- Report.Campaign.ForwardsOverall
- Report.Campaign.ForwardsDetail
- Report.Campaign.BounceOverall
- Report.Campaign.BounceDetail
- Report.Campaign.SpamComplains
- Report.List.Advisory
- Report.List.Performance
- Report.List.BounceOverall
- Report.List.BounceDetails
- Report.List.Opens
- Report.List.Clicks
- Report.List.Forwards
- Report.List.BrowserViews
- Report.List.Activities
- Report.List.EmailServices
Media Library Functions
Chart Functions