Skip to content

API specifications

Smyler edited this page Jul 4, 2023 · 3 revisions

About the API and this doc

The API always takes its arguments (if any) as GET parameters and sends back the result in the response's body as a JSON object. Various endpoints offer various functionalities and often have subdivisions. By convention, all paths will be given from the root of the web address.

Endpoints

/info

Available since 0.0.2
Returns information about the API instance in use.
E.G. https://smybteapi.smyler.net/info ->

{
   "software-version": "1.0.9",
   "software-license": "MIT License",
   "software-credit": "SmylerMC \u003csmyler@mail.com\u003e",
   "software-repo": "https://github.com/SmylerMC/smyler-bte-api",
   "instance-name": "Main SmyBTE API instance at smybteapi.smyler.net",
   "instance-administrator": "SmylerMC \u003csmyler@mail.com\u003e",
   "instance-info": "Ask for information on the BTE development hub discord",
   "host":"smybteapi.smyler.net",
   "client":"88.164.41.70",
   "user-agent":"Mozilla/5.0 (X11; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0"
}

/projection

This endpoints is subdivided and offers functionalities related to the Terra++ projections. In requests, geographic coordinates are encoded as latitude,longitude where latitude and longitude are in decimal degrees, encoded as finite 64 bit floating point values (e.g. 45.18,175.623), and Minecraft coordinates are encoded as x,z where x and z are block coordinates, encoded as 64 bit floating point values (e.g. 1847.0,18.67)..

/projection/toGeo

Available since 0.0.7
Converts Minecraft coordinates to latitude and longitude.
Parameters:

  • mcpos (can be present multiple times) Minecraft coordinates to convert

Returns:

  • geo_positions a list containing one entry for each time mcpos was specified in the request. Each entry is either a list containing latitude and longitude as two 64 bits floating points values, or null if the specified point was out the projection's bounds.
  • total an integer counting the number of time mcpos was specified in the request.
  • success an integer counting the number of point which were successfully projected.
  • out_of_bounds an integer counting the number of point which were out of the projection's bounds and were not projected.

E.G. https://smybteapi.smyler.net/projection/toGeo?mcpos=2851824,-5050670&mcpos=11571988,-6472387&mcpos=10000000000000,-1000000000 ->

{
   "geo_positions": [
      [48.86471138417888, 2.3490083011787912],
      [39.907499316999925, 116.39722635370677],
      null
   ],
   "total":3,
   "success":2,
   "out_of_bounds":1
}

/projection/fromGeo

Available since 0.0.7
Converts latitude and longitude to Minecraft block coordinates.
Parameters:

  • geopos (can be present multiple times) Geographic coordinates to convert

Returns:

  • mc_positions a list containing one entry for each time geopos was specified in the request. Each entry is either a list containing x and z as two 64 bits floating points values, or null if the specified point was out the projection's bounds.
  • total an integer counting the number of time geopos was specified in the request.
  • success an integer counting the number of point which were successfully projected.
  • out_of_bounds an integer counting the number of point which were out of the projection's bounds and were not projected.

E.G. https://smybteapi.smyler.net/projection/fromGeo?geopos=48.864716,2.349014&geopos=39.9075000,116.3972300 ->

{
   "mc_positions": [
      [2851824.5980688347, -5050670.37323142],
      [1.1571988173618957E7, -6472387.375809908]
   ],
   "total": 2,
   "success": 2,
   "out_of_bounds": 0
}