Developer API
WemX comes with an out-of-the-box API, which will allow you to provide an API to your users or build a mobile app from your API.
In this section we will go into more depth on how you can use the WemX API.
Disclaimer: This API is for WemX and not the Billing Module. The Billing Module has it's own API using Pterodactyl
Access Data from the API
In order to access data from the API a user or an application will need to pass an Access Token to the API. This access token will determine what kind of data can be accessed or returned.
There are 2 ways to get an Access Token:
- You can request an Access Token from an API key.
- You can request an Access Token with an email and password.
Get Access Token from an API Key
To create an API key you can visit your API settings page at: /settings/api
, then to create a new API key, enter a name in the textbox and click on the Create New Key
button.
After creating your new API key you will see it in the list of Current API Keys. You'll be able to see the Name, Date Created, and the Last Used. There are also 3 actions you can do with this new API Key. To view the current API Key. Click on the View
button:
And you will see the current API key where you can copy and paste it to be used.
Next, you can click on the Edit
button:
Where you will be able to edit the current API key name.
Lastly, if you click on the delete button:
You will be able to delete the current API key.
Next, let's move on to learning how you can use this API key to request an Access Token from the API. After we recieve the Access Token we can then use that to retrieve data from our application.
To request an Access Token we can submit a POST request to:
/api/token?key=API_KEY_HERE
And you will get a response that looks similar to the following:
{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC93YXZlLnRlc3RcL2FwaVwvdG9rZW4iLCJpYXQiOjE1Mzk4MDg4OTUsImV4cCI6MTUzOTgxMjQ5NSwibmJmIjoxNTM5ODA4ODk1LCJqdGkiOiJRdTViYnhwdlBkNE9tT3ZZIiwic3ViIjoyLCJwcnYiOiI4N2UwYWYxZWY5ZmQxNTgxMmZkZWM5NzE1M2ExNGUwYjA0NzU0NmFhIn0.AJNTXTlnI74ZyPw2rqvEaI7P5YPaLnZNWcCBBmRX0W0"
}
This is the Access Token we will use to retrieve data in our application. We'll show you how to use this Access Token in the next few steps.