
You can use our PHP class to communicate with chimeratool.com.cn servers: transfer credits, revoke credit transfers, gather informations about your account (eg. your credit balance), list your transfers and identify chimeratool users.
Our PHP class communicates over the HTTPS protocol and uses the GET method to retreive data in the JSON format.
You can download the PHP call here.
Error codes and messages
The API calls can respond with different error codes, so you can easily identify the error.
Connections errors
000 | Couldn't connect to API |
001 | No response from API server |
Authentication errors
100 | Login failed due to no given username or API key |
101 | Can't authenticate user with the given username or API key |
102 | User is currently inactive |
103 | User is locked (banned) |
104 | User has an unread important reseller message. It can be read on https://chimeratool.com.cn/reseller/. (need to be loged in before opening the link) After you read and accept it, the API will work again. |
105 | User is not eligible for reseller status |
Transfer errors
400 | 'userId' parameter is not set |
401 | 'amount' parameter is not set |
402 | 'amount' value is not numeric |
403 | 'amount' value must be 1.0 or greater |
404 | You don't have enough credits. |
405 | Can't find the user identified by the given 'userId' |
406 | Can't transfer to yourself |
407 | An Exception happened during the process. (contact with the support team immediately) |
408 | The minimum transferable amount to a reseller is 20000 credits |
409 | The maximum transferable amount is 18000 credits |
410 | 'userId' value must be numeric. |
Listing erros
200 | 'limit' value can't be larger then 200 |
201 | 'page' number must be a positive number |
202 | 'limit' number must be a positive number |
Revoke errors
300 | You have to set the 'transferId' parameter |
301 | Can't find the transfer record with the given ID |
302 | Can't revoke the transfer because it is older than 1 day |
303 | The user does not have enough credits to revoke from |
304 | The transfer is already revoked |
Check user errors
500 | Can't find the user with the given parameters |
501 | 'user' parameter was not given |
502 | User permission related errors |
Check ChimeraCard errors
600 | 'serialnumber' parameter is missing |
601 | ChimeraCard not found |
602 | ChimeraCard status error |
Check userlicences errors
700 | 'user' parameter is missing |
701 | User not found |
702 | Unknown error |
Sell licence errors
801 | 'targetid' parameter is missing |
802 | 'targettype' parameter is missing |
803 | 'licencename' parameter is missing |
804 | Could not find the licence |
805 | targettype error |
806 | Target check error |
807 | Not enough credit |
808 | Could not find the User/ChimeraCard |
| 809 | 'targetid' must be integer |
Extend licence errors
901 | 'userlicenceid' parameter is missing |
902 | Could not find the licence |
903 | User check error |
904 | Licence not extendable |
905 | Not enough credit |
Upgrade licence errors
1001 | 'userlicenceid' parameter is missing |
1002 | Could not find licence |
1003 | User check error |
1004 | Licence not upgradeable |
1005 | 'licencename' parameter is not valid |
1006 | Not enough credit |
1007 | Same 'licencename' as user licence has |
Revoke licence errors
1100 | actionID is invalid |
1101 | action not found |
1102 | can't revoke the licence because the transfer is older than 1 day |
1104 | action type is not "Licence sell" |
1105 | action is already revoked |
1107 | unknown error |
API functions
All functions return with an associative array, that always has a boolean type element called 'success'. If its value is FALSE, then the API call was unsuccessful and you can find 'code' and 'message' keys in the response array too. The 'code' and 'message' elements describe the error. Error codes are listed above.
In the case that there is no error, there can be various responses. The listing below explains every functions along with their parameters and return values. The listing of return values signify the keys of the returned associative array.
ChimeraApi::getTransferList($page = 1, $limit = 50)
You can query/list your transactions with this method. You can get the IDs of the transactions that you would like to revoke. The generated list is ordered by date in descending order.
Parameters:
- $page - page of result set (first page is 1)
- $limit - number of results in one page (can not be larger then 200)
It is like a standard paging function. If you have 500 transactions and the $limit is set to 50, then the first page will show the results from transactions 1-50, and the second page will show transactions 51-100.
Return:
- success - indicates if the call was successful (boolean)
- transfers - list of credit transfers (associative array)
- id - transfer ID (int)
- date - date of transfer (associative array, serialized DateTime object)
- from - user's name where the credits came from (string)
- to - user's name where the credits were sent to (string)
- amount - transfered credit amount (decimal)
- revoked - indicates that the transactions was revoked (boolean)
ChimeraApi::getInfo()
Gives information about your account.
Parameters: -
Return:
- success - indicates if the call was successful (boolean)
- creditBalance - your current credit balance
- transfersCount - number of your credit transfers
ChimeraApi::transferCredit($userId, $amount)
Transfers '$amount' credit from your account to '$userId'.
Parameters:
- $userId - ID of the user that you want to send credit to
- $amount - number of the credits you want to transfer
Return:
- success - indicates if the call was successful (boolean)
transferId - ID of the credit transfer (integer)
- message - human readable success message
ChimeraApi::revokeTransfer($transferId)
Revoke the transfer identified by '$transferId'.
Parameters:
- $transferId - ID of the credit transfer that you want to revoke (get from transferCredit)
Return:
- success - indicates if the call was successful (boolean)
- message - human readable success message
ChimeraApi::checkUser($username, $email)
You can verify a user with this function. It responds with the ID of the given user.
Parameters:
- $username - name of the user
Return:
- success - indicates if the call was successful (boolean)
- userId - ID of the given user
ChimeraApi::checkChimeraCard($serialnumber)
You can verify a ChimeraCard with this function.
Parameters:
- $serialnumber - serial number of the card
Return:
- success - indicates if the call was successful (boolean)
- serialnumber - serial number of the ChimeraCard (string)
- haslicence - indicates if the ChimeraCard has a licence (boolean)
- licencename - if the ChimeraCard has a licence then the licence name (string) is here, otherwise null
ChimeraApi::checkUserLicences($username, $email)
Check user's licences.
Parameters:
- $username - name of the user
Return:
- success - indicates if the call was successful (boolean)
- userId - ID of the given user
- licences - user's licences (array)
ChimeraApi::sellLicence($targetid, $targettype, $licencename)
Sell a licence.
Parameters:
- $targetid - id of the target (userID or ChimeraCard serialnumber)
- $targettype - either 'user' or 'chimeracard'
- $licencename - name of licence
Return:
- success - indicates if the call was successful (boolean)
actionId - ID of the reseller action (integer)
ChimeraApi::extendLicence($userlicenceid)
Extend a licence.
Parameters:
- $userlicenceid - ID of the User's licence
Return:
- success - indicates if the call was successful (boolean)
ChimeraApi::upgradeLicence($userlicenceid, $licencename = 'Pro')
Upgrade a licence.
Parameters:
- $userlicenceid - ID of the User's licence
- $licencename - either 'Pro' or 'Premium', defaults to 'Pro' (optional)
Return:
- success - indicates if the call was successful (boolean)
ChimeraApi::availableLicences()
Lists available licences
Parameters:
- -
Return:
- licences - available licences (array)
ChimeraApi::buyLicencePrices($userId)
Calculates licence prices for user
Parameters:
- $userId
Return:
- licences - available licences (array)
ChimeraApi::getSoldLicenceList($page, $limit)
Returns the list of sold licence
Parameters:
- $page - page number
- $limit - results per page
Return:
- success
- soldLicences - (array)
- pagination - informations for pagination
ChimeraApi::revokeLicence($actionId)
Revokes a sold licence (if possible)
Parameters:
- $actionId - ID of the action (get from sellLicence and getSoldLicenceList)
Return:
- success
