List Badges

From KickApps Documentation

Jump to: navigation, search

Contents

Overview

This method is an admin method that will list all badges for an AS either site-wide or for a specific location. This can be further filtered by published status. This method will require a Webmaster / moderator token.


Request URL

 
http://api.kickapps.com/rest/badges/list/{as}


Request Parameters

Required

  • t - the user token generated via the "Create Token" API call. Must be a webmaster / moderator token.
  • as - The site Id to search. as is unique for each of the affiliate's sites.


Optional

  • callback. String. Optional. The name of your JavaScript callback function.
  • location – customer’s designation of the area of their web site the queried badges belong to [64 characters] If omitted from the query, all badges for this AS are returned. If specified, only badges associated with the location will be returned.
  • published – if true, returns all published badges. If false, returns all badges that aren’t published. If not provided in the query, all badges are returned regardless of their published status.

Response

Note: if callback is provided as an optional argument, the results illustrated below will be returned within the callback string provided for execution of a JavaScript function; e.g. callback=”MyCallbackFunc” will return something similar to:

MyCallbackFunc({…the success or failure response contained in curly braces you see below…});
Success:
{
   "status":1,
   "badges":[
      {
         "badgeId":"1234",
   "location":"XXXX",
         "name":"XXXX",
         "verbosename":"XXXX",
         "published":"true",
         "url":"http://someimage.com/image.jpg",
         "link":"http://someurlontheweb.com"
      },
      {
         "badgeId":"2345",
   "location":"YYYY",
         "name":"YYYY",
         "verbosename":"YYYY",
   "published":"false",
         "url":"http://someimage.com/image.jpg",
   "link":"http://someurlontheweb.com"
      }
   ]
}
Failure: {"status": -1, "errorId": "123", "error": "Error Message"}


Response Parameters

  • status – 1 on success and -1 on error.
  • error – A message indicating the error condition
  • errorId – A numeric reference to the error condition
  • badges
  • badgeId – The ID of the badge just added into the system.
  • location – location of badge in site
  • name – brief name of badge
  • verbosename – Verbose name of badge
  • published – true, false (Is the badge turned on?)
  • url – A URL to the badge's image file.
  • link – link to area associated with this badge – no validation


errorId and errors

(*Note: This error may only occur if the corresponding optional request parameter is provided. Null values provided for optional parameters result in ignoring the parameter; treating it as if it was not provided. While the error message may read “cannot be null”, there will never be a condition where a null value for an optional parameter can result in an error.)

  • 1 = invalid token
  • 7 = invalid value for published (must be true or false) (*)
  • 8 = location cannot be blank (*)
  • 18 = Insufficient user permissions for this operation
  • 20 = location cannot exceed 64 characters
  • 44 = token required

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.