myCred REST API

Estimated reading: 2 minutes 193 views

myCred REST API

Introduction

myCred REST API enables the heroic engineers of various tech stacks to use the point system with their superheroic projects. Whether you are an Angular Ninja, React Rockstar or Ruby Gem you can use myCred within your apps.

Endpoints

  1. Points
  2. Badges
  3. Ranks

Points

{ "access_key": "", "user_id": "", "type": "", "ctype": "", "reference": "", "amount": "", "entry": "" }

Parameters

ParamTypeRequiredDescription
access_keystringYesAn authorization key to access myCred RESTful web service.Default: None
user_idintYesThe ID of the User getting the points.Default: None
typestringYesThe action you want to perform. Pass “add” or “get”. Add to add points. Get to fetch points.Default: None
ctypestringNoThe point type key. Should only be used if you are adjusting a custom point type and not the default one.
referencestringNoThe reference to log this entry. You can use your own custom reference OR one of the built-in.Default: Nonerequired if type == add
amountfloatNoThe point amount to give to the User. This can be positive OR negative value.Default: Nonerequired if type == add
entrystringNoThe entry to save in the log for this adjustment.Default: Nonerequired if type == add

Badges

{ "access_key": "", "user_id": "", "type": "", "ctype": "" }

Parameters

ParamTypeRequiredDescription
access_keystringYesAn authorization key to access myCred RESTful web service.Default: None
user_idintYesThe ID of the User getting the points. In case if there’s no user_id the service will return all ranks with type getDefault: None
typestringYesThe action you want to perform. Get is the only type ranks handles.Default: get
ctypestringNoThe point type key. Should only be used if you are adjusting a custom point type and not the default one.

References

{ "access_key": "", "user_id": "", "type": "" }

Parameters

ParamTypeRequiredDescription
access_keystringYesAn authorization key to access myCred RESTful web service.Default: None
user_idintYesThe ID of the User getting the points.Default: None
typestringYesThe action you want to perform. Get is the only type referenced.Default: get
add_filter( 'mycred_all_references', 'mycredpro_add_custom_references' ); function mycredpro_add_custom_references( $list ) { $list['my_reference'] = 'My Custom Reference'; return $list; }

Settings

  • Navigate to WordPress admin Dashboard > myCred > General settings > REST API
  • You are required to pass this key with each POST request, along with other required and optional arguments.