The REST API allows you to retrieve, create, update and delete SliceWP stored data via external requests.
This add-on opens up almost limitless possibilities, from something as simple as updating an affiliate’s status based on an event triggered by another application, to building your own complex dashboards based on the data you retrieve from your site.
This article will guide you through the process of setting up and getting started with the REST API add-on. Let’s dive in.
Step 1: Activating the REST API add-on
To get started, purchase a SliceWP Pro or Pro Plus license. This will unlock the REST API add-on, alongside all other add-ons to help you take your affiliate program to the next level.
Then follow these steps:
- From your SliceWP account page, download and install the SliceWP Pro plugin. Click here for a step-by-step guide on how to do this.
- Once you have SliceWP Pro installed, navigate to your WordPress admin area > SliceWP > Add-ons page and activate the REST API add-on.
Step 2: Creating an API key
To validate your requests, you will need to set up an API key. Without these keys you will not be able to retrieve or modify the data in any way.
Here’s how you can create your first SliceWP API key:
- Navigate to SliceWP > Settings > Tools (tab) > API Keys (section). Here, click the Add new API key button.
- Then, name your API key, so that you can identify it later and select the user that will be authenticated when making requests. Only administrator users can be selected. Then select between Read, Write and Read/Write to set the permissions this set of API keys will have.
- Lastly, click the Generate API key button. Once you do this, SliceWP will create a Consumer Key and a Consumer Secret key that you can use to make requests.
Last step: Making requests
Now that you’ve set up the add-on and you’ve generated your first API keys, you can start making requests to retrieve, create, update and delete SliceWP stored data.
Click here to see our detailed documentation article about the endpoints you have at your fingertips.