Email Media

From KickApps Documentation

Jump to: navigation, search

Emails an invitation containing a link to view a media play page. A given username can send up to 20 emails in a 24-hour period. In your request, separate multiple addresses or usernames by commas. You can make an HTTP POST or GET request for this call.

Important. A member of a given affiliate site can send up to 20 emails per day. If this is not sufficient for you members' needs, please contact KickApps.

Your request will look something like the following:

http://api.kickapps.com/rest/email/{mediaType}/{mediaId}/{as}

Contents

Parameters

As shown above, your call will include the following parameters:

  • mediaType. The media type. audio, photo, blog, sets or video. KickApps' sample applications use mediaType to check for the Flash player to use.
  • mediaId. The id of the media that is being emailed. This is specific to both the as and the media type.
  • as. The site to be sent. as is unique for each of the affiliate's sites.

Post Parameters

  • t. String. Required. Your access permissions.
  • callback. String. Optional. The name of your JavaScript callback function.
  • clientIP. String. Optional. Use the clientIP parameter to pass the IP address of the user making the call. If the IP has been blocked by the webmaster under the Affiliate Center -> Manage Members section, an error message will be returned starting with "status":"-1","error":"This IP address has been banned".
  • friends. The recipient’s email address or KickApps username. Separate multiple addresses or usernames by commas.
  • fromName. The name of the sender.
  • mediaName. The media item's title.
  • customMessage. A message of between 0 and 5,000 characters in length.

Example Requests

The following requests show an application's call to the REST API, see the relevant sample application code for more details. In the examples, "friends" is a comma-separated list of email addresses.

Java

NameValuePair[] tokenParams = {new NameValuePair("t", ka_token.getToken()),
new NameValuePair("customMessage", customMessage),
new NameValuePair("fromName", fromName),
new NameValuePair("friends", friends),
new NameValuePair("mediaName", mediaName) };
if (fromName != null) {
if (ka_token != null) {

System.out.println(KickAppsHttpClient.EMAIL_PAGE_URL
+ mediaType + "/" + mediaId + "/" + as);
JSONObject playPageObject = KickAppsHttpClient.doRestCall(KickAppsHttpClient.EMAIL_PAGE_URL
+ mediaType + "/" + mediaId + "/" + as,
"POST", tokenParams);

C#

The C# sample app uses af as the value for as (affiliate site id).

objclsRestClient = new clsRestClient();
RestUrl = clsRestClient.EMAIL_PAGE_URL +    mediaType + "/" + mediaId + "/" + af;

NameValueCollection parameters = new NameValueCollection();
parameters.Add("t", objToken.TOKEN);
parameters.Add("customMessage", customMessage);
parameters.Add("fromName", fromName);
parameters.Add("friends", friends);
parameters.Add("mediaName", mediaName);

result = objclsRestClient.doRestCall(RestUrl, "POST", parameters);
objToken.PAYLOAD = result;

PHP

$ka_token=$_SESSION['token'];

if ($ka_token == "" || $ka_token->getToken() == "") {
	//Since token is null member is not logged in send them back
	redirect(dirname($_SERVER['PHP_SELF'])."/login.php");
}
		
$as = $ka_token->getAs();
$customMessage = $_REQUEST['customMessage'];
$fromName = $_REQUEST['fromName'];
$friends = $_REQUEST['friends'];
$mediaName = $_REQUEST['mediaName'];
$mediaType = $_REQUEST['mediaType'];
$mediaId = $_REQUEST['mediaId'];

						
$rest_url = EMAIL_PAGE_URL . $mediaType ."/".$mediaId."/".$as;

$ch = curl_init($rest_url);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, 't='.$ka_token->getToken().'&customMessage='.$customMessage.'&fromName='.$fromName.'&friends='.$friends.'&mediaName='.$mediaName);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if ($fromName != "") {
	if ($ka_token != "") {
		$buf=curl_exec ($ch);

		curl_close ($ch);	

JSON Payload

On success, a payload that begins with "status":"1","error":"".



List of KickApps API Calls


Note: Occasionally (and without advanced warning) we modify our API calls by adding new parameters in the response payload. Please keep this in mind when designing your strategy for parsing our responses.