# AutoSystem API
AutoSystem.io provides a simple and efficient integration platform to take many gaming suppliers through a single API for your casino operations.
# Table of Contents
* [Introduction to Document](#AutoSystem-API)
* [Security Implementation](#Security-Implementation)
* [API Endpoint](#API-Endpoint)
* [IP Restrictions](#IP-Restrictions)
* [API - Seamless Cloud](#API---Seamless-Cloud)
* [Response Code](#Response-Code)
* [Example Code](#Example-Code)
# Security Implementation
Before sending or calling to our API Endpoint, Request IP **"Your IP"** must whitelist in our system
Can whitelist in Back office with "API Manage"
> HTTP header required
| Field | Example Value | Description |
| -------- | -------- | -------- |
| operator-token | Token1234 | Operator verify token |
| secret-key | Secret1234 | Secret key verify token is valid |
# API Endpoint
You need to **"Whitelist your IP"** first before can send any request to our API endpoint
| URL | Environment | Status |
| -------- | -------- | -------- |
| https://api-prod.autosystem.io/api | Production Environment | Active |
# IP Restrictions
All APIs are only available for the IP provided by Whitelist IP in Back office
# API - Seamless Cloud
## User Manage
> Create User, Get User Information or wallet information
### Create User
> Example request:
HTTP method: **POST**
URL: **{{ endpoint }}/user/create**
```
{
"userName": "Test12345",
"name": "John Doe",
"registeredIp": "127.0.0.1"
}
```
> Example response
```
{
"code": 0,
"msg": "success"
}
```
### Get User Info
> Example request:
> HTTP method: GET
> URL: {{ url }}/user/info/{userName}
> Example response
```
{
"code": 0,
"msg": "success",
"data": {
"userName": "GPGTest12345",
"systemUser": "Test12345",
"name": "John Doe",
"locked": 0,
"active": 1,
"registeredIp": "127.0.0.1",
"registeredDomain": "autosystem.io",
"createdAt": "2022-01-01 00:00:00",
"updatedAt": "2022-01-01 00:00:00",
"wallet": {
"balance": 0,
"lockedBalance": 0,
"currencyCode": "THB"
}
}
}
```
### Get Wallet
> Example request:
> HTTP method: GET
> URL: {{ url }}/user/wallet/{userName}
> Example response
```
{
"code": 0,
"msg": "success",
"data": {
"balance": 0,
"lockedBalance": 0,
"currencyCode": "THB"
}
}
```
## Game Manage
> Get platform and Game list with information
### Launch Game
> Example request:
>
HTTP method: **POST**
URL: **{{ endpoint }}/platform/login**
```
{
"userName": "Test1234",
"gameCode": "SAL",
"mobile": 0,
"ip": "127.0.0.1",
"returnUrl": "https://google.com"
}
```
> Example response
```
{
"code": 0,
"msg": "success",
"data": {
"gameUrl": "https://exmaple.com/game?token=TestToken1234"
},
"count": 1
}
```
---
### Get Platform
> Example request:
HTTP method: GET
URL: {{ url }}/platform
> Example response
```
{
"code": 0,
"msg": "success",
"data": [
{
"platformId": 1,
"platformName": "SA Gaming",
"platformCode": "SA",
"carryForward": 0,
"value": "100.00",
"outstanding": "0.00"
}
...
],
"count": 1
}
```
---
### Get Game
> Example request:
HTTP method: GET
URL: {{ url }}/platform/game?platformId={platformId}
> Example response
```
{
"code": 0,
"msg": "success",
"data": [
{
"gameId": 30,
"gameCategory": 2,
"gameName": "SA Gaming",
"gameCode": "SAL",
"bannerUrl": null,
"describe": null,
"recommend": 0,
"popular": 0,
"demo": 0,
"active": 1
}
...
],
"count": 1
}
```
## Fund Manage
### Credit
> Example request:
>
HTTP method: **POST**
URL: **{{ endpoint }}/fund/credit**
```
{
"userName": "Test1234",
"amount": 10,
"txnId": "CREDIT1013245",
"remark": "",
}
```
> Example response
```
{
"code": 0,
"msg": "success",
"data": [
"balance": 10
]
}
```
### Debit
> Example request:
>
HTTP method: **POST**
URL: **{{ endpoint }}/fund/debit**
```
{
"userName": "Test1234",
"amount": 10,
"txnId": "CREDIT1013245",
"remark": "",
}
```
> Example response
```
{
"code": 0,
"msg": "success",
"data": [
"balance": 0
]
}
```
### Get Fund History
> Example request:
HTTP method: **GET**
URL: **{{ endpoint }}/fund/history?type={type}&userName={userName}&startDate=2021-01-01&endDate=2021-01-02**
> Example response
```
{
"code": 0,
"msg": "success",
"data": [],
"count": 0
}
```
# Response Code
Our API will response with JSON format and following fields
| Response Code | Message | Description |
| -------- | -------- | -------- |
| 0 | success | Operation Successful |
| 404 | not found | HTTP not found |
| 405 | method not allowed | HTTP method not allowed |
| 1000 | invalid parameters | Parameter Error |
| 1001 | request body must be json format | Request content must be JSON format |
| 1002 | ip not in whitelist | Request IP not whitelist |
| 1003 | operator token is incorrect | Operator Token not found or invalid |
| 1004 | operator access denied | Operator invalid request type |
| 1005 | many requests | Flooding request to API endpoint |
| 1006 | user exist | Create user failed, Username already exist |
| 1007 | game maintenance | Game Under Maintenance |
| 1008 | launch game failed | Launch Game Failed |
| 1009 | operator credit not enought | Credit to user failed, Operator credit not enought |
| 1010 | user credit not enought | User credit not enought |
| 1011 | game not found | Game not found |
| 1012 | user not found | User not found |
| 9999 | system error | Database error, Operation failed |
# Example Code
* [PHP Demo](https://github.com/babylongplay/ats-php-demo)
* [NodeJS Demo](https://github.com/babylongplay/ats-nodejs-demo)
* [GOLANG Demo](https://github.com/babylongplay/ats-golang-demo)