Search

From KickApps Documentation

Jump to: navigation, search
Looking for Search functions within KickApps? Try this page: Search application

Search for keyword tags and display media items by type (audio, video and photo files, along with members and blogs). You can make an HTTP POST or GET request when making this call.

Your request will look something like the following:

http://api.kickapps.com/rest/search/{as}

Note: Our RSS API offers a more comprehensive set of sorting and filtering features for most search queries. Documentation for our RSS API is available here:

RSS Feed API

Contents

Parameters

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

  • as. The site that you are searching. Each affiliate site has a unique as.

Post Parameters

For the first search call, use the following values, pgNum "1", totPages "1" and totSize "0". The server will return the actual values for these post parameters, given your search criteria.

  • 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".
  • includeAudio. Optional. on or off. Default is on. Whether or not to search audio files.
  • includePhoto. on or off. Default is on. Whether or not to search photos.
  • includeVideo. on or off. Default is on. Whether or not to search video files.
  • includeSets. on or off. Default is on. Whether or not to search sets.
  • includeUser. on or off. Default is on. Whether or not to search members.
  • includeBlog. on or off. Default is on. Whether or not to search blogs.
  • pgNum. The current page number in the search results. Five results are displayed on each page. For your first call, set pgNum to "1". For subsequent calls, set pgNum to the page you want to display.
  • pageSize. The number of results to display on each page.
  • totPage. The total number of pages returned. Each page contains five search results. For your first call, set totPages to "1", for subsequent calls, set pgNum to the total number of pages you want to display to the member or to the value for totPages returned by the server.
  • totSize. Required if using pagination. Total number of records.
  • keywords. A comma separated list of the term or terms to search for. Use URL-encoded space characters (%20) to search for multi-word terms. If you do not specify keyword, the search will return all results. For example, if includeAudio=On and includeVideo=On and no values for keyword were specified, then the search results will return all audio and video files for the site.
  • searchType. The sort ordering to use. Default is "recent". Values are: recent, popular, commented, rating, items (for sets only).
  • meta. The meta-data has a format of <name>=<value>. To search for more than two meta-data, you can use a semicolon separated each meta-data pairs. If a value is not provided using either "name;name=value" or "name=;name=value", the results will match for any media item with the meta-data name regardless of the values of the meta item.
  • metaCreator. Username of the member who added the meta-data. This parameter can be use if the value of meta has been added. If not, we will ignore the searching on metaCreator.


Example Requests

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


PHP

includeAudio, includeVideo, includePhoto can each be either "on" or "off"

$ka_token=$_SESSION['token'];

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

$rest_url = SEARCH_PAGE_URL .$as;

$ch = curl_init($rest_url);
curl_setopt ($ch, CURLOPT_HTTPGET, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, 't='.$ka_token->getToken().'&keywords='.$keywords);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$buf=curl_exec ($ch);

curl_close ($ch);


JSON Payload

On success, a return that begins with "totSize":"","totPages":"","status":"1","error":"" where:

  • totSize. The total number of comments posted by the member.
  • totPages. The total number of pages that the comments will display on.
  • status. 1 if the call was a success. -1 if the call produced an error.
  • error. If the call status is -1, error will contain descriptive text for the error.

The payload will contain the following for each search result:

favoriteCount The number of members who marked this media as a favorite.
isDisabled true or false. Default is false. In the Affiliate Center's Member Management area, affiliates can see and manage member status (pending/approved/disabled). If a member or media is disabled or pending, then the member or media is not searchable and does not appear to other members, only in the Affiliate Center.
pathToPreview The URL to the media preview:
  • For a video, the file is transcoded and then five random screens are grabbed from the file. An affiliate can choose the preview image from among these screens, upload their own image, or use the default image.
  • For photo, this is a path to a thumbnail version of the image. This image was manually uploaded by the member and then automatically resized to for the thumbnail or is the default image.
  • For audio, this is a path either to a selected preview image loaded by the member or to the default image.
userId The id of the member who uploaded the media.
views The number of times this media item was viewed. Increments each time the media item is viewed. Not supported for text blogs.
createdAt A nested object stating when the media was created in the following format. All times are returned as Greenwich Mean Time (GMT).
dayofweek, month day, time AMorPM

This would appear as follows: "createdAt":"Wednesday, Jul 7, 07:48"

searchType The type of search for which this media will appear in the results. Possible values are audio, photo, and video.
title The descriptive name for the search result.
averageRating The average rating calculated using all the ratings issued for this media.
pathToPhoto The URL to the photo displayed in the list.
tags Zero or more searchable, descriptive keywords entered by members. Appears as a comma-separated list.
description A text description of this media. This description is added by the owner when the media is uploaded.
pathToIcon The URL to the stored thumbnail for this media.
numComments The number of comments left on the media.
pathToMedia Only applicable to when external media is included in the search. It is the url associated with the external media.
transcodingStatus Indicates whether a video has been transcoded or is still being transcoded. Possible values: "INPROCESS", "SUCCEDED", or "FAILED".

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.