Register a game server for access restriction notifications¶
This API automatically sends data to the game server in real time when access restriction user information is newly registered or changed, or when an access restriction is released. With this API, the game server can immediately receive changes in a user's restriction status and apply them to the service.
- Data delivery time: Data is automatically delivered to the game server when access restriction user information is newly registered or changed, and when an access restriction is released. Access restriction release includes both manual release by an administrator and expiration of the restriction period. In both cases,
statusis delivered asE. - Data delivery unit: Up to 100 access restriction user records are delivered in one request. However, to guarantee the processing order for the same user, users are divided into multiple groups before delivery, so a request is not always filled with 100 records even when there are many targets. The number of requests and records per request depends on the distribution of target users.
To use this API, prepare a game server that can receive requests, then register the game server in Hive Console > Authentication > Access Restriction > Register game server.
Notes for game server implementation
- Prepare for duplicate delivery (ensure idempotency): If network delivery fails, retry logic runs, so the same event data can be received more than once. The game server must process requests idempotently so that the system state remains consistent even when the same request is received multiple times.
- Processing order can be reversed: While a failed request is stored in the retry queue and sent later, following requests can be sent first without waiting. Therefore, if events such as "registration -> change -> release" occur in quick succession for the same user, the request arrival order can be reversed.
- Determine the latest state (compare
event_time): Because request arrival order can differ from the actual event order, always compare theevent_timefield before applying received data to the game server, and process it only after determining whether it is the latest state. For the detailed logic, see Determine processing order. - Health checks for the game server are required: Separately from access restriction user information, health check requests are sent periodically to verify that the game server can receive data. If the game server does not respond normally to these requests, event delivery stops. Be sure to check and handle the Health check for game server guide.
Request URL¶
| Request URL | Game server URL for the project registered in Hive Console ([Authentication > Access Restriction > Register game server]) |
|---|---|
| HTTP Method | POST |
| Content-Type | application/json |
| Data Format | JSON |
Request header¶
| Field name | Description | Type | Required |
|---|---|---|---|
| Authorization | Bearer token for game server authentication Delivered in the format Bearer {Game server authentication key}. | String | Y |
Note
- You can find the game server authentication key in Hive Console [Authentication > Access Restriction > Register game server > Project details > Game server authentication key].
- Game server authentication key verification must be implemented directly on the game server that receives the request.
Request body¶
| Field name | Description | Type | Required |
|---|---|---|---|
| game_index | Game index | Integer | Y |
| server_url | Game server URL | String | Y |
| data | List of access restriction users (up to 100 records) | List | Y |
| data[].event_time | Event publication time (epoch milliseconds) The value used by the game server to determine processing order. Details | Long | Y |
| data[].player_id | Player ID | Integer | Y |
| data[].status | Access restriction status
| String | Y |
| data[].start_date | Access restriction start date If status is E, the start date of the released access restriction is delivered. | String | Y |
| data[].end_date | Access restriction end date If status is E, the end date of the released access restriction is delivered. | String | Y |
Request example¶
All items in data in a single request have the same status and the same event_time. Different statuses are not mixed in one request.
Timed access restriction (B)¶
{
"game_index": 539,
"server_url": "{Game server URL for the project registered in Hive Console}",
"data": [
{
"event_time": 1720612623847,
"player_id": 1,
"status": "B",
"start_date": "2024-07-10 20:56:59",
"end_date": "2024-07-13 20:56:59"
},
{
"event_time": 1720612623847,
"player_id": 2,
"status": "B",
"start_date": "2024-07-10 20:56:59",
"end_date": "2024-07-13 20:56:59"
}
]
}
Permanent access restriction (P)¶
{
"game_index": 539,
"server_url": "{Game server URL for the project registered in Hive Console}",
"data": [
{
"event_time": 1720612624215,
"player_id": 3,
"status": "P",
"start_date": "2024-07-10 20:56:59",
"end_date": "9999-12-31 00:00:00"
},
{
"event_time": 1720612624215,
"player_id": 4,
"status": "P",
"start_date": "2024-07-10 20:56:59",
"end_date": "9999-12-31 00:00:00"
}
]
}
Release access restriction (E)¶
The period of the released access restriction is delivered as-is, so start_date and end_date can differ for each user.
{
"game_index": 539,
"server_url": "{Game server URL for the project registered in Hive Console}",
"data": [
{
"event_time": 1720829722391,
"player_id": 5,
"status": "E",
"start_date": "2024-07-01 10:00:00",
"end_date": "2024-07-08 10:00:00"
},
{
"event_time": 1720829722391,
"player_id": 6,
"status": "E",
"start_date": "2024-07-03 15:30:00",
"end_date": "9999-12-31 00:00:00"
}
]
}
Determine processing order¶
event_time is the time when the Hive server published the information, expressed in epoch milliseconds (milliseconds elapsed since January 1, 1970 00:00:00 UTC). For example, 1720612623847 is 2024-07-10 20:57:03.847 in KST. A larger value means a later process, so the game server can determine the latest state by comparing this value regardless of the order in which requests arrive.
Store the last applied event_time for each player_id, then compare it with the newly received value and process it as follows.
| Comparison result | Meaning | Processing |
|---|---|---|
| Received value > stored value | A later process | Apply it and update the stored value |
| Received value = stored value | Redelivery of an already applied process | Ignore it, or reapply it idempotently |
| Received value < stored value | Past process that arrived late | Ignore it |
Notes when using event_time
- Compare only users with the same
player_id. Different users can have the sameevent_time, so comparing without distinguishing users can cause normal requests to be mistaken for past processes and skipped. - Redelivered requests keep the original publication time. The value is not updated just because the request is redelivered, so you can use this value to filter out past requests that arrive late.
event_timeis the time published by the Hive server, so it differs from the game server receipt time and fromstart_dateorend_date. Useevent_time, notstart_date, to determine order.event_timeis an absolute time independent of time zones. Even if the game server and Hive server use different time zones, the order determination result does not change.
If you need to confirm whether the received value is the latest state, query the user's current state with the Check users with game access restrictions API.
Response body¶
After processing the request normally, the game server must respond in the following format.
| Field name | Description | Type |
|---|---|---|
| result_code | Response code Details | Integer |
Response code¶
| Code value | Description |
|---|---|
| 0 | Success |
| Other values | Failure (error code defined by the game server) |
Response example¶
Success¶
Health check for game server¶
Health check requests are sent at regular intervals to verify that the registered game server can receive access restriction user information. The request URL, request header, and request body format are the same as those used for actual access restriction user information delivery.
The delivery interval can be adjusted depending on operational conditions. Therefore, the game server must not be implemented with assumptions about a specific interval. It must always be able to return a normal response regardless of when a request is received.
The data field of a health check request contains only one dummy data item with player_id set to 1, as shown below.
player_id:1(a dummy ID that does not actually exist)event_time/start_date: The time when the health check request was sent- Exception handling required: A request with
player_idset to1is only a signal used to check whether the server can receive data. Do not run actual access restriction logic for it, and exclude it from processing order determination.
{
"game_index": 539,
"server_url": "{Game server URL for the project registered in Hive Console}",
"data": [
{
"event_time": 1720612623847,
"player_id": 1,
"status": "P",
"start_date": "2024-07-10 20:57:03",
"end_date": "9999-12-31 00:00:00"
}
]
}
The game server must return a response that includes result_code for health check requests as well. The value of result_code is not checked; only the presence of the field is checked. Therefore, even if the game server determines that the user does not exist and returns a failure code other than 0, it is treated as a normal response.
Access restriction user information delivery stops if the health check fails
If there is no response, or if a response without result_code occurs five times in a row, the game server changes to an unavailable state. From that point, actual access restriction user information is no longer delivered. If the server later responds normally to a health check request, it automatically recovers to an available state and delivery resumes.
Therefore, do not filter out requests with player_id set to 1 separately. Process them through the same path as actual requests and always return a response that includes result_code.