Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
67 lines (54 sloc) 2.87 KB

API specification

This document was written to aid Reporter client developers.

You need to perform a POST /send HTTP request to upload a single step of a chronicle. Recommended encoding is (obviously) multipart/form-data. A set of required fields is called a "protocol" here. There are multiple protocol versions, described below.

If a version is unknown or unsupported, the server responds with 501 Not Implemented. If some fields are missing or have invalid values, the server responds with 400 Bad Request. You can determine which versions are supported by querying /api.json.

v1

  • protocolVersion (int): 1.
  • agent (string): A line identifying the user agent, typically, of the form ClientName/ClientVersion.
  • link (string): An absolute link to the log (e.g., https://godville.net/duels/log/xxxxxxx).
  • stepDuration (float): Number of seconds a single step lasts.
  • scale (float): The map scale. It is the radius of a circle, circumscribed around a tile's hexagon.
  • step (int): The step number, starting from 1.
  • playerIndex (int): The number of a player that streams the log, starting from 1. 0 can be passed here to indicate that player is unknown.
  • cargo (string): Contents of the streamer's ship's hold (e.g., [♂][♀]).
  • data (string): outerHTML of allies, map, and chronicle blocks (in that order) joined together with <&>, then compressed with deflate or gzip algorithm, then Base64-encoded. Higher compression rates are achieved when concatenating everything together. <&> was chosen as a delimiter because it cannot occur in HTMLs.

v2

  • protocolVersion (int): 2.
  • agent (string): See v1.
  • link (string): See v1.
  • stepDuration (float): See v1.
  • scale (float)
  • timezone (int): Streamer's local time's offset from UTC, in minutes. E.g., MSK (which is UTC+3) should have a timezone equal to 180.
  • step (int): See v1.
  • playerNumber (int): Renamed playerIndex from v1.
  • cargo (string): See v1.
  • data (string): See v1.

v3

  • protocolVersion (int): 3.
  • agent (string): See v1.
  • link (string): See v1.
  • stepDuration (float): See v1.
  • timezone (int): See v2.
  • step (int): See v1.
  • playerNumber (int): See v2.
  • cargo (string): See v1.
  • data (string): See v1.
  • clientData (string): Arbitrary JSON-encoded data. The Reporter does not use it in any way, except for propagating to a stream page. It's available there as window.gReporterClientData and updates on each step. If you don't need this functionality, pass null.
You can’t perform that action at this time.