Add Media Comment

From KickApps Documentation

Jump to: navigation, search

Add one member comment to specified media. A member must be logged in to post a comment. You can make an HTTP POST or GET request when using this call. You can also retrieve comments for a given piece of media using the Retrieve Play Page call. To add a comment to a member profile, see the Add Profile Comment call.

Your request will look something like the following:

http://api.kickapps.com/rest/comment/add/v2/{mediaType}/{mediaId}/{as}

Contents

Parameters

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

  • mediaType. The media type. audio, photo, blog, video, sets or emedia.
  • mediaId. The id of the media to which the comment is being added. This is specific to both the as and the media type. For external media, this value can be any integer, but it must be included (it is nonfunctional).
  • as. The site to which the comment will be added. 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".
  • url. Required for external media only (do not include in other calls). The url of the external media (same as pathToMedia).
  • comment. Required. The actual text of the comment to add. Each comment can be between 1 and 5,000 characters in length. If you are commenting a blog, the comment can be a maximum of 40,000 characters.
  • parentThreadId. Integer. To enable comment nesting just pass the comment id for the comment to which you want to reply to.
  • updatedAt. Optional. The date on which the media should be marked as modified. If its not passed the the time this call is made will be used. Format: mm/dd/yyyy hh:mm
  • createdAt. Optional. The date on which the media should be marked as created. If its not passed the the time this call is made will be used. Format: mm/dd/yyyy hh:mm

Example Requests

The following requests show an application's call to the REST API, see the relevant sample application code for more details.

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();
$mediaType = $_REQUEST['mediaType'];
$mediaId = $_REQUEST['mediaId'];
$comment = $_REQUEST['comment'];

$rest_url = COMMENTS_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().'&comment='.$comment);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$buf=curl_exec ($ch);

curl_close ($ch);

JSON Payload

On success a similar payload will be returned:

{"message":"The comment has been added successfuly.","newCommentId":55814,"error":"","status":"1","payload_type":"json"}

On error a similar payload will be returned:

{"payload_type":"json","status":"-1","error":"unable to locate media"}

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.