Any plans on making a publicly available API?
Any plans on making a publicly available API?
I recently got into Diplomacy and it has been a blast, as my excitement for the game grew, the more the urge to create some rudimentary commands to my discord bot grew. I searched for an API but could not find one so I decided to just web scrape which works but is quite annoying and brings overall performance down. But making commands that revolve around notifying everyone when a new turn has begun is noticeably harder to create without the help of an API, so as the title imply is there any future plans to make a webDiplomacy api?
Re: Any plans on making a publicly available API?
Yes its called log in and check
Octavious is an hypocritical, supercilious tit.
Re: Any plans on making a publicly available API?
I would love to see an adjudication API. However, I don't think that this will be possible.
-
- Posts: 4
- Joined: Thu Oct 21, 2021 9:10 pm
- Contact:
Re: Any plans on making a publicly available API?
I would be happy to make a Discord bot for you if you want... all it would have to do is check the map every 5 minutes and see if there have been any changes.
-
- Posts: 4
- Joined: Thu Oct 21, 2021 9:10 pm
- Contact:
Re: Any plans on making a publicly available API?
Aparently one already exists never mind.
viewtopic.php?f=16&t=2771
viewtopic.php?f=16&t=2771
Re: Any plans on making a publicly available API?
I've already done that, but thanks for asking!alviac2186 wrote: ↑Thu May 19, 2022 11:45 pmI would be happy to make a Discord bot for you if you want... all it would have to do is check the map every 5 minutes and see if there have been any changes.
Re: Any plans on making a publicly available API?
I saw it. But the point was I myself wanted to make something myself (which I have done but I would love to make it more efficient)alviac2186 wrote: ↑Fri May 20, 2022 6:19 amAparently one already exists never mind.
viewtopic.php?f=16&t=2771
Re: Any plans on making a publicly available API?
There isn't a public API.
What do you want to do? Just get the turn information for a specific game? I know this isn't the answer you're looking for, but webdip is open source - if you wanted to make a PR, you could make a copy of board.php and strip it back to just render the information you're looking for as JSON. https://github.com/kestasjk/webDiplomac ... /board.php
Side node: what are you using to do web scraping? You shouldn't be hitting performance issues because of scraping. The time to make the http call should be by far the biggest cost, and for a bot that fires every few minutes, an API and scraper should be similarly performant. Of course, not scraping is better - it'll be cleaner, a nicer development experience, and more robust if the site changes etc. But if you're hitting performance issues, I think something might be misconfigured or maybe there are mistakes in the implementation.
What do you want to do? Just get the turn information for a specific game? I know this isn't the answer you're looking for, but webdip is open source - if you wanted to make a PR, you could make a copy of board.php and strip it back to just render the information you're looking for as JSON. https://github.com/kestasjk/webDiplomac ... /board.php
Side node: what are you using to do web scraping? You shouldn't be hitting performance issues because of scraping. The time to make the http call should be by far the biggest cost, and for a bot that fires every few minutes, an API and scraper should be similarly performant. Of course, not scraping is better - it'll be cleaner, a nicer development experience, and more robust if the site changes etc. But if you're hitting performance issues, I think something might be misconfigured or maybe there are mistakes in the implementation.
Re: Any plans on making a publicly available API?
Check out https://github.com/kestasjk/webDiplomacy/api.php , https://github.com/kestasjk/webDiplomacy/ajax.php , and https://github.com/kestasjk/webDiplomacy/board.php (with a GET arg ?mapType=json )KraftaN wrote: ↑Wed May 18, 2022 9:21 amI recently got into Diplomacy and it has been a blast, as my excitement for the game grew, the more the urge to create some rudimentary commands to my discord bot grew. I searched for an API but could not find one so I decided to just web scrape which works but is quite annoying and brings overall performance down. But making commands that revolve around notifying everyone when a new turn has begun is noticeably harder to create without the help of an API, so as the title imply is there any future plans to make a webDiplomacy api?
Collectively I these interfaces let you send and receive messages, cast votes, submit orders, get the board state, get your orders to be submitted, submit orders, mute/unmute, get the order and board history, and get the game state, all via JSON.
You'd have to authenticate by POSTing a username and password and reading the cookie that's returned, I don't think there is game search, game create, game join, or game leave yet, but those wouldn't be much effort to add.
Besides that it's pretty complete.
Re: Any plans on making a publicly available API?
To be honest one of the things I'd really like to do is gut out all the HTML from webDip and replace it all with Bootstrap or something like that. I don't think the site can get a modern HTML design incrementally it'd need to be redone, so I wouldn't recommend scraping for anything you're not prepared to have to abruptly redoA_Tin_Can wrote: ↑Sat May 21, 2022 5:30 pmSide node: what are you using to do web scraping? You shouldn't be hitting performance issues because of scraping. The time to make the http call should be by far the biggest cost, and for a bot that fires every few minutes, an API and scraper should be similarly performant. Of course, not scraping is better - it'll be cleaner, a nicer development experience, and more robust if the site changes etc. But if you're hitting performance issues, I think something might be misconfigured or maybe there are mistakes in the implementation.
It's probably 4th/5th down the list of big projects, so it won't happen for a long time, but still
Re: Any plans on making a publicly available API?
In https://github.com/kestasjk/webDiplomac ... master/api, it says:
I'm hoping to connect an e-ink display to webdiplomacy so I can poll every ~30 mins or so and see new messages in games I'm playing.
Does anyone know how I can get a long-living key? Or should I just authenticate with username and password and use the cookie?To get an API key, please contact web site administrator.
I'm hoping to connect an e-ink display to webdiplomacy so I can poll every ~30 mins or so and see new messages in games I'm playing.
Re: Any plans on making a publicly available API?
If you're just doing regular user activities and want to make client apps etc feel free to use cookie authentication, but please don't do any actual bot order submission etc as we want to know which users are bots and which aren't.
Sound like an interesting project, keep us posted.
Sound like an interesting project, keep us posted.
Re: Any plans on making a publicly available API?
Sounds good! That makes sense. It won’t be a bot (in fact it will be read-only).
Who is online
Users browsing this forum: No registered users