API and In-game Shop implementation for the TERA Online retail server (patch 92/100) on Node.js. The API consists of four independent servers (Arbiter API, Portal API, Shop API and Admin Panel) running on different ports.
The Arbiter API intended for processing internal requests from the Arbiter Server, such as checking a token, receiving events about the character's behavior, etc. This API must be binded only on a local IP address and must not be accessed by external users!
The Portal API is a web server intended for the Launcher/Shop. This API must be available from the outside (proxied by Nginx or binded on external IP) for use by server users: registration, authorization, login, update routines etc. Also, this API allows to process static elements (directory public).
Built-in admin panel for full control of all functionality and viewing API logs. There is also full integration with the Box Server and Steer Server (for setting permissions).
- Node.js v18.1.0
- MySQL Server v5.7.38
- TERA Retail Server patch 92.03, 92.04 or 100.02
- Steer Server
- Box Server
- Install latest node.js from https://nodejs.org.
- Copy the all tera-api files to any directory (e.g. c:\tera-api).
- Execute the
npm install
command in your tera-api directory, or just run install.bat. - Import the database files in file names order to your MySQL server.
- Unpack the tera-icons.zip archive to tera-api\data\tera-icons folder.
- Download and unpack fonts to tera-api\public folder.
- Copy or rename the .env.example file to .env.
- Configure the parameters in the .env file.
- Execute the
node src/app
command, or run the file tera-api.bat to start TERA API servers.
If you don't plan to use tera-client-packer to automatically update the client through the launcher, set parameter API_PORTAL_CLIENT_PATCH_NO_CHECK
to true
in your .env config file.
By default, the admin panel is available on all IP addresses on port 8050, like https://127.0.0.1:8050. You can change this in the .env settings. To enter the admin panel, use login apiadmin
and password password
. These credentials should be used only for tests, and in production you need to set up integration with the Steer Server.
- Install and configure the Steer Server.
- Open Steer Web admin panel.
- Go to Import/export section and select Import.
- Select the file ExportSteerData_steeradmin_API.sef and confirm import.
- Go to Manage user section and select Add user.
- Create new user named like imsadmin.
- Go to Authority connect section and select Connect user - user group.
- Select your user on left and click Add user group connection on right section.
- In new window select group API_AdminPanel_Admin and click add.
- Open your .env file and set
STEER_ENABLE
parameter totrue
.
The Steer Server allows you to flexibly manage permissions to certain sections of the TERA API Admin Panel. For example, you can create a new user and connect it to user group API_AdminPanel_Shop. Users in this group will only have access to Shop management functions. You can also create your own function group.
- Install and configure the Steer Server, Box Server.
- Go to your TERA Server arb_gw directory and open config config_arb_gw.txt.
- Modify the patamerer
web_shop_url
value ashttps://YOUR_API_HOST/tera/ShopAuth?authKey=%s
, whereYOUR_API_HOST
specify your TERA API (Portal API) host. - Go to your TERA Server Bin directory and open DeploymentConfig.xml.
- Remove or comment the line like this
<Shop url="..." />
. - Open your .env and set the
API_PORTAL_SHOP_ENABLE
parameter totrue
.
TERA Shop products are configured through the TERA API Admin Panel. The creation of a Service Item in the Box System occurs automatically when a product is added (using the Platform Hub).
You can further setting of Promo codes, Chronoscrolls (Premium Items), Admin Panel and Shop by editing the files in the config directory.
The API includes one more server (Gateway API Server) designed for remote access to data managed by the API and performing certain actions, such as requesting the server online monitoring, Shop balance, funding the Shop balance, etc.
If you need to implement a Shop balance change using your external billing site, please use this API instead of directly changing the database.
Endpoint | Method | Arguments | Description |
---|---|---|---|
/serverApi/GetServerInfoByServerId | GET | serverId | Request the server information of specified server ID. |
/accountApi/GetAccountInfoByUserNo | GET | userNo | Request the account information of specified account ID. |
/accountApi/GetAccountBanByUserNo | GET | userNo, clientIP | Request the account banned status of specified account ID and client IP. |
/shopApi/GetAccountInfoByUserNo | GET | userNo | Request the Shop balance of the specified account ID. |
/shopApi/FundByUserNo | POST | userNo, transactionId, amount | Fund the Shop balance of the specified account ID. |
The API and the Shop require data of item templates, item conversions, item strings etc. This data must be uploaded into the MySQL database (data for patch 100.02 is already included). The API also requires of some client datasheets placed into directory data\datasheets (the necessary datasheets for patch 100.02 already included).
If you plan to use the API with another TERA patch, you will need to update this data. To update the data in the MySQL database, you can use tool src\tools\dataItemsUpdater.js. For it to work, you need to place the client datasheets (unpacked by program novadrop-dc, download) into directory share\dataitems\[lang] and run command node src/tools/dataItemsUpdater.js [lang]
. Where lang specify your datasheet language code, like en, ru, etc.