API Documentation
CyberBukit script comes with a simple RESTful API. The main purpose of the API is to let CyberBukit script works with your other APPs. For example, you create a mobile app. Then you can verify the user's credentials through the API when user signs in your app. That means you use CyberBukit's user database as your APP's. The API is also applicable for sign-up and the reset-password request.
You need to upgrade to the latest version before use. Go to Admin Tools -> Upgrade Software to see whether it's the latest version.
First of all, you should enable the API from the super admin dashboard: Global Setting -> General Setting -> Enable API.
The base URL of the API is http(s)://your_host/api/v1/{{method}}
For example, you use the GET method to get the system's status: https://your_host/api/v1/status, it will return some JSON data describing the status.
No authentication required for the API as all the methods are for public use purpose.
In some cases, you may want to restrict the source IP of the API calls. Follow the instructions to achieve this:
1. open application\config\rest.php, go to line 233, set it true. Go to line 258, enter your IP address.
2. open application\controllers\Api_v1.php, go to line 10, set it false.
You can test all the API methods in Postman.
1. GET /status
URL: http(s)://your_host/api/v1/status
Feature: It returns the status of the system.
Request: Not Required
Response:
{
"status": true,
"message": "The system is running"
}
2. GET /signin
URL: http(s)://your_host/api/v1/signin
Feature: Verify when user signs in, check the user's credentials and return the user's profile.
Request:
{
"username":"admin",
"password":"admin"
}
Response:
{
"status": true,
"message": {
"ids": "0bWHjn9usb065a85cc223037e3b5dff82c4c08fba2XaMlC3Gk",
"status": "1",
"username ": "admin",
"balance": "{\"usd\":0}",
"emailAddress": "[email protected]",
"phone": "",
"firstName": "Super",
"lastName": "Admin",
"timezone": "Asia/Singapore",
"dateFormat": "Y-m-d",
"timeFormat": "H:i:s",
"language": "English",
"currency": "USD",
"country": "",
"addressLine1": "",
"addressLine2": "",
"city": "",
"state": "",
"zipCode": "",
"createdTime": "2020-12-01 08:00:00",
"updateTime": "2021-01-29 09:42:35"
}
}
3. PUT /signup
URL: http(s)://your_host/api/v1/signup
Feature: Send the sign-up request the CyberBukit script, if email address verification is required, an email will be sent.
Request:
{
"emailAddress": "[email protected]",
"firstName": "Super",
"lastName": "Admin",
"password": "123456"
}
Response:
{
"status": true,
"message": "Signup complete! You may sign in..."
}
4. POST /forget
URL: http(s)//your_host/api/v1/forget
Feature: Send the reset-password request to the script, A reset email will be sent if applicable.
Request:
{
"emailAddress": "[email protected]"
}
Response:
{
"status": true,
"message": "A password reset link has been sent. Please check the email and follow..."
}