myCred – REST API is an add-on for the myCred WordPress plugin that allows developers to interact with the myCred plugin through an API. This REST API extension is useful for integrating myCred’s points management system with external systems, applications, or websites, offering greater flexibility in how you manage and interact with user points in WordPress.
Key Features of the myCred REST API Add-On
- Access to User Points Data:
- The REST API allows external systems or applications to retrieve and manage user points data. This includes getting current user points, adding or subtracting points, and interacting with the point balances programmatically.
- You can fetch data like the user’s current point balance, transaction history, and other related details.
- Integration with External Applications:
- The REST API enables seamless integration between your WordPress site and external applications, websites, or platforms that may need to interact with the myCred system. For example, you can connect the API to a custom web or mobile app to manage points across various touchpoints.
- This allows businesses or service providers to sync user points with their own systems (e.g., loyalty programs, external CRM tools, or membership management systems).
- Add or Deduct Points:
- With the myCred REST API, you can programmatically add or deduct points from a user's balance. This can be triggered by specific events or actions outside of the standard WordPress environment (e.g., points awarded for completing external tasks or purchases).
- For example, you could add points based on an external service, such as a purchase made on another website, or for actions in a mobile app that integrates with WordPress.
- Transaction Management:
- You can retrieve or create transactions associated with user points. This includes information like the transaction type, the amount of points involved, and any custom data linked to the transaction.
- The API provides a way to automate the creation of transactions for specific user actions or events, reducing manual intervention.
- Customization and Flexibility:
- The myCred REST API offers a lot of flexibility for developers to customize the way points are awarded or deducted. You can define specific rules and conditions within the external application, which can then interact with the myCred system via the API.
- Secure Authentication:
- The REST API ensures secure authentication for all requests. Developers can use OAuth2 authentication or API keys to ensure that only authorized applications can interact with the myCred system, protecting the integrity of your points data.
- Custom Endpoints:
- Developers can create custom endpoints to expose additional features or functionality based on the specific needs of their project or integration. This provides extensive control over the type of data and actions that are available through the API.
- Event Triggering:
- The myCred API supports the ability to trigger certain actions when specific events occur. For instance, when a user reaches a certain number of points, an external system could trigger a reward or notification based on the points balance.
- Developers can also set up custom events that react to changes in the points system.
- Easy Documentation and Access:
- The myCred REST API comes with comprehensive documentation, making it easier for developers to understand how to make API requests, manage authentication, and perform specific tasks with the API.
How to Use the myCred REST API
- Install myCred:
- First, ensure that you have myCred installed and configured on your WordPress site. You can download the myCred plugin from the WordPress Plugin Repository or from the myCred website.
- Enable the REST API Add-On:
- Once myCred is installed, you will need to install and activate the REST API add-on. This is a separate plugin that adds the REST API functionality to your myCred installation.
- After installation, navigate to the plugin’s settings to configure the API key and authentication settings.
- Authentication:
- To interact with the API, you'll need to authenticate requests. This can be done using OAuth2 authentication or by generating an API key within the WordPress admin panel.
- The authentication process ensures that only authorized parties can access or modify user points data.
- Make API Requests:
- Once the API is set up, you can start making HTTP requests (GET, POST, PUT, DELETE) to interact with the myCred system.
- For example:
- GET request to retrieve a user’s point balance.
- POST request to add points to a user’s account.
- DELETE request to remove points from a user’s account.
GET /wp-json/mycred/v1/users/{user_id}/points
- Test the Integration:
- After setting up and making your requests, you should test the integration to ensure the API is properly interacting with myCred, and the correct points are being added or deducted based on the actions taken in the external system.
Use Cases for myCred REST API
- External Loyalty Programs:
- You can integrate myCred with an external loyalty program system where users earn points for activities outside your WordPress site. For example, users might receive points for engaging with a mobile app or purchasing items from an external site.
- Mobile App Integrations:
- If you have a mobile app that needs to track points or rewards, the myCred REST API allows you to sync the mobile app’s data with the WordPress site, ensuring that users’ point balances are consistent across platforms.
- Custom Point Rules:
- If you need to create complex rules for awarding or deducting points (such as rewarding specific actions in an external app or tracking points across multiple services), the myCred REST API provides a flexible platform for doing so.
- CRM and Marketing Integrations:
- You can integrate the myCred system with CRM tools or marketing platforms to track users’ points as part of their customer profiles. This helps you personalize marketing campaigns or reward customers based on their activity and engagement.
- Gamification and User Engagement:
- The API can be used in gamification systems, where users earn points for completing challenges or actions within your site or external platforms. The myCred REST API allows external apps or services to award points automatically.