Jump to content

Adding Treaties to API


Menhera
 Share

Recommended Posts

This might be a minor issue, but right now even with the new Alliance API we don't really have a way to see alliance treaties in any way unless we'd webscrape it (which to my knowledge is against game rules)

As far as i was able to tell, there wasn't really any deliberate reason why it wasn't implemented already (like server strain or something), so i assume it probably just flew under the radar. The last mention i could find of a treaty api suggestion was this post back in 2017, where it wasn't really elaborated on.

Possible uses might be to create custom treaty webs, be able to log treaties to see how spheres develop over time, include new signature alerts in bots like warnet etc.

As to how this might be implemented in the v3 api, there could be a new field in the alliances API that contains an array of objects, like how it already exists with the nations field.

{
  "data": {
    "alliances": {
      "data": [
        {
          "treaties": [
            {
              "date": "2021-03-27",
              "signatory": "guardian",
              "type": "mdoap",
              "link": "https://something"
              "turns_remaining": "348"
            },
            {
              "date": "2021-03-29",
              "signatory": "rose",
              "type": "piat",
              "link": "https://somethingelse"
              "turns_remaining": "372"
            }
          ]
        }
      ]
    }
  }
}

Since i'm not a programmer, people might have better suggestions how to implement it or what to add, but this is more or less how such an api could look like. The "turns_remaining" field can also be replaced by some other form of time measurement.

Edited by Menhera
Added date, link and time remaining fields to the code

mlem.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and the Guidelines of the game and community.