Any plans on making a publicly available API?

Developers and contributors can find a link to our github page and engage in development project planning here.
Post Reply
Message
Author
KraftaN
Posts: 3
Joined: Fri May 06, 2022 7:21 am
Contact:

Any plans on making a publicly available API?

#1 Post by KraftaN » Wed May 18, 2022 9:21 am

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?

Wusti
Posts: 409
Joined: Thu Oct 19, 2017 10:12 pm
Contact:

Re: Any plans on making a publicly available API?

#2 Post by Wusti » Thu May 19, 2022 9:13 am

Yes its called log in and check :P
Octavious is an hypocritical, supercilious tit.

wulfheart
Posts: 63
Joined: Thu Jan 18, 2018 7:35 pm
Contact:

Re: Any plans on making a publicly available API?

#3 Post by wulfheart » Thu May 19, 2022 7:06 pm

I would love to see an adjudication API. However, I don't think that this will be possible.

alviac2186
Posts: 4
Joined: Thu Oct 21, 2021 9:10 pm
Contact:

Re: Any plans on making a publicly available API?

#4 Post by alviac2186 » Thu May 19, 2022 11:45 pm

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.

alviac2186
Posts: 4
Joined: Thu Oct 21, 2021 9:10 pm
Contact:

Re: Any plans on making a publicly available API?

#5 Post by alviac2186 » Fri May 20, 2022 6:19 am

Aparently one already exists never mind.
viewtopic.php?f=16&t=2771

KraftaN
Posts: 3
Joined: Fri May 06, 2022 7:21 am
Contact:

Re: Any plans on making a publicly available API?

#6 Post by KraftaN » Fri May 20, 2022 11:53 am

alviac2186 wrote:
Thu May 19, 2022 11:45 pm
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.
I've already done that, but thanks for asking!

KraftaN
Posts: 3
Joined: Fri May 06, 2022 7:21 am
Contact:

Re: Any plans on making a publicly available API?

#7 Post by KraftaN » Fri May 20, 2022 11:55 am

alviac2186 wrote:
Fri May 20, 2022 6:19 am
Aparently one already exists never mind.
viewtopic.php?f=16&t=2771
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)

A_Tin_Can
Lifetime Site Contributor
Posts: 283
Joined: Fri Sep 29, 2017 9:18 pm
Contact:

Re: Any plans on making a publicly available API?

#8 Post by A_Tin_Can » Sat May 21, 2022 5:30 pm

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.

User avatar
kestasjk
Developer
Developer
Posts: 534
Joined: Tue Mar 14, 2017 8:13 pm
Location: Perth, Australia
Contact:

Re: Any plans on making a publicly available API?

#9 Post by kestasjk » Sat Jun 04, 2022 3:22 am

KraftaN wrote:
Wed May 18, 2022 9:21 am
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?
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 )

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.

User avatar
kestasjk
Developer
Developer
Posts: 534
Joined: Tue Mar 14, 2017 8:13 pm
Location: Perth, Australia
Contact:

Re: Any plans on making a publicly available API?

#10 Post by kestasjk » Sat Jun 04, 2022 3:29 am

A_Tin_Can wrote:
Sat May 21, 2022 5:30 pm
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.
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 redo

It's probably 4th/5th down the list of big projects, so it won't happen for a long time, but still

c5m
Posts: 4
Joined: Sun Sep 11, 2022 3:30 am
Contact:

Re: Any plans on making a publicly available API?

#11 Post by c5m » Tue Sep 13, 2022 3:46 pm

In https://github.com/kestasjk/webDiplomac ... master/api, it says:
To get an API key, please contact web site administrator.
Does anyone know how I can get a long-living key? Or should I just authenticate with username and password and use the cookie?

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.

User avatar
kestasjk
Developer
Developer
Posts: 534
Joined: Tue Mar 14, 2017 8:13 pm
Location: Perth, Australia
Contact:

Re: Any plans on making a publicly available API?

#12 Post by kestasjk » Tue Sep 13, 2022 5:41 pm

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.

c5m
Posts: 4
Joined: Sun Sep 11, 2022 3:30 am
Contact:

Re: Any plans on making a publicly available API?

#13 Post by c5m » Tue Sep 13, 2022 6:35 pm

Sounds good! That makes sense. It won’t be a bot (in fact it will be read-only).

Post Reply

Who is online

Users browsing this forum: No registered users