Edit Badge Requirement

From KickApps Documentation

Jump to: navigation, search

Contents

Overview

This method is an admin method that, given a badge requirement id, will edit the properties of an existing Badge Requirement in the community. This method will require a webmaster / moderator token. Note: When a Badge requirement is modified, all users need to be reevaluated to determine if any should be awarded the badge based on the requirements modification (could be original badgeId and changed badsgeId). A badge that’s been awarded should never be taken away from a user due to a badge requirements change.


Request URL

http://api.kickapps.com/rest/badgerequirement/edit/{as}

Request Parameters

Required

  • t - the user token generated via the "Create Token" API call. Must be a webmaster / moderator token.
  • requirementId - The badge requirement ID of an existing badge requirement in the system.


Optional

  • callback. String. Optional. The name of your JavaScript callback function.
  • badgeId – The badge ID of an existing badge in the system. (Note: Requires reevaluation of users that may either earn the original badgeId value and this new badgeId value.)
  • actionId - The ID of an existing action in the system.
  • location – A location identifier that corresponds to a page / area within the community. For this iteration of the API it is assumed that Client will handle creation of these identifiers in their existing CMS system.
  • quantity – Integer from 1-N containing the number of times this action must occur for a user to meet this action’s requirement towards earning this badge.
  • published – Is this requirements active / published in the system? (true, false)

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, "updated": True, "requirementId":"1234"}
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
  • requirementId – The ID of the Badge Requirement just updated in the system.
  • updated – Boolean value indicating Badge Requirement was successfully updated.

Error codes:

  • 1 = invalid token
  • 7 = invalid value for published (must be true or false)
  • 8 = location cannot be blank
  • 9 = Invalid badgeId
  • 10 = invalid actionId
  • 11 = quantity must be a positive integer
  • 12 = published must be set to true or false
  • 18 = Insufficient user permissions for this operation
  • 20 = location cannot exceed 64 characters
  • 19 = Invalid requirementId (Note: You can’t edit a requirement that doesn’t exist.)
  • 24 = You cannot duplicate existing badge requirement (Note: You can’t define more than one requirement for the same badge + location + action. This could occur when a user tries to edit an existing requirement and changes its location and/or action in a way that duplicates the criteria of another requirement of the badge.)
  • 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.