Project Overview

NationsGlory API Proxy is a Rust-based intermediary service designed to act as a proxy between clients and the NationsGlory API. Its primary purpose is to handle rate limiting and caching, ensuring that clients do not encounter rate limit errors and can benefit from cached responses for improved performance.

How to Use

Obtaining an API Key

First, obtain an NationsGlory API key from the official NationsGlory API.

Making Requests

Once you have your API key, you can make requests to the proxy server by including your API key(s) in the Authorization header.

Example

To fetch notations for a specific week and server, you can use the following curl command:

curl -H "Authorization: <your_api_key>" "http://localhost:8000/notations?week=2880&server=red&country=france"

You can include multiple API keys by separating them with commas. This is useful to have less waiting time between requests:

curl -H "Authorization: <your_api_key1>,<your_api_key2>" "http://localhost:8000/notations?week=2880&server=red&country=france"

API Endpoints

GET /planning?<server>&<month>&<year>

Fetches the planning for a given server, month, and year.

Parameters:

Example:

curl "http://localhost:8000/planning?server=red&month=06&year=2024"

GET /playercount

Fetches the current player count.

Example:

curl "http://localhost:8000/playercount"

GET /hdv/<server>/list

Fetches the list of items available in the in-game auction house for a specific server.

Parameters:

Example:

curl "http://localhost:8000/hdv/red/list"

GET /notations?<week>&<server>&<country>

Fetches notations for a specific week and server, optionally filtered by country.

Parameters:

Example:

curl "http://localhost:8000/notations?week=2880&server=red&country=france"

GET /country/<server>/<country>

Fetches information about a specific country on a specific server.

Parameters:

Example:

curl "http://localhost:8000/country/red/france"

GET /country/list/<server>

Fetches a list of all countries on a specific server.

Parameters:

Example:

curl "http://localhost:8000/country/list/red"

GET /user/<username>

Fetches information about a specific user.

Parameters:

Example:

curl "http://localhost:8000/user/exampleUser"

GET /ngisland/list?<page>

Fetches a paginated list of islands on NGIsland.

Parameters:

Example:

curl "http://localhost:8000/ngisland/list?page=1"

Additional Information

Caching: The proxy uses Redis to cache responses, reducing the number of requests sent to the NationsGlory API and improving response times.

Rate Limiting: The proxy manages API key usage to avoid hitting rate limits, ensuring smooth operation even under high load.