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
Points
Badges
Ranks
Points
{ "access_key": "", "user_id": "", "type": "", "ctype": "", "reference": "", "amount": "", "entry": "" }
Parameters
Param Type Required Description access_key string Yes An authorization key to access myCred RESTful web service.Default: None user_id int Yes The ID of the User getting the points.Default: None type string Yes The action you want to perform. Pass “add” or “get”. Add to add points. Get to fetch points.Default: None ctype string No The point type key. Should only be used if you are adjusting a custom point type and not the default one. reference string No The reference to log this entry. You can use your own custom reference OR one of the built-in.Default: Nonerequired if type == add amount float No The point amount to give to the User. This can be positive OR negative value.Default: Nonerequired if type == add entry string No The entry to save in the log for this adjustment.Default: Nonerequired if type == add
Badges
{ "access_key": "", "user_id": "", "type": "", "ctype": "" }
Parameters
Param Type Required Description access_key string Yes An authorization key to access myCred RESTful web service.Default: None user_id int Yes The 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 type string Yes The action you want to perform. Get is the only type ranks handles.Default: get ctype string No The 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
Param Type Required Description access_key string Yes An authorization key to access myCred RESTful web service.Default: None user_id int Yes The ID of the User getting the points.Default: None type string Yes The 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.