API Usage

From Crafters Wiki
Jump to navigation Jump to search

CraftersAPI Documentation

Introduction

Welcome to the CraftersAPI documentation. This API allows players to access various statistics from the Crafters.one server . To use the API, you need to obtain an API key, which is given on request via tickets, and make requests to the endpoints provided.

Obtaining an API Key

To interact with the CraftersAPI, you must have an API key. Open a ticket to request permission to use the API. Once permission is obtained; follow these steps to get your API key:

1. In-Game Command: Use the command /craftersapi new <NameOfAPIKey> in-game to generate a new API key.

2. Viewing Keys: Use the command /craftersapi keys to view your active API keys.

3. Cancelling a Key: Use the command /craftersapi cancel <NameOfAPIKey> to cancel an existing API key.

You will be able to view all keys generated by your account, cancelled or active, via the /craftersapi keys command.

Making Requests

Base URL

All API requests are made to the following base URL:

https://crafters.one/api/v1

Authentication

All requests to the API must include a valid API key. The API key should be included as a query parameter.

Rate Limiting

The API is rate-limited to 600 requests per 10 minutes per IP address.

Endpoints

Get Player Stats

Endpoint

GET /stats

Parameters

  • apikey (required): Your API key.
  • player (required): The UUID of the player whose stats you want to retrieve.

Example Request

GET https://crafters.one/api/v1/stats?apikey=YOUR_API_KEY&player=PLAYER_UUID

Response

A successful request returns a JSON object containing the player's statistics. Example response:

   "animals_bred": 5,
   "cake_slices_eaten": 2,
   "damage_absorbed": 50,
   "damage_dealt": 200,
   "damage_dealt_absorbed": 70,
   "damage_dealt_resisted": 40,
   "damage_resisted": 30,
   "damage_taken": 150,
   "deaths": 9,
   "fish_caught": 0,
   "join_date": 1622470420,
   "jumps": 500,
   "mob_kills": 20,
   "play_time": 13690,
   "player_kills": 0,
   "score": 500,
   "time_since_death": 3600,
   "time_since_rest": 1800

Error Responses

If there is an error with your request, you will receive a JSON response with an error field. Example error response:

   "error": "Invalid API key"

Additional Information

  • animals_bred: The number of animals bred by the player.
  • cake_slices_eaten: The number of cake slices eaten by the player.
  • damage_absorbed: The total damage absorbed by the player.
  • damage_dealt: The total damage dealt by the player.
  • damage_dealt_absorbed: The total damage dealt by the player that was absorbed.
  • damage_dealt_resisted: The total damage dealt by the player that was resisted.
  • damage_resisted: The total damage resisted by the player.
  • damage_taken: The total damage taken by the player.
  • deaths: The number of times the player has died.
  • fish_caught: The number of fish caught by the player.
  • join_date: The timestamp of when the player first joined the server.
  • jumps: The number of jumps made by the player.
  • mob_kills: The number of mobs killed by the player.
  • play_time: The total playtime in seconds.
  • player_kills: The number of other players the player has killed.
  • score: The player's current score.
  • time_since_death: The time in seconds since the player last died.
  • time_since_rest: The time in seconds since the player last rested.

Conclusion

This documentation should help you get started with using the CraftersAPI. If you have any questions or encounter any issues please contact [email protected] or open a ticket for assistance.