Yosodog Posted January 19, 2016 Share Posted January 19, 2016 PHP is horrible with variable types. It's perfectly happy keeping an integer as a string, right up until you use it in a calculation. At which point, it will think of it as an integer and the result will be an integer. //PHP a='5'; //string b=5; //integer c=a+b; //c is now 10At least it's slightly better than Javascript. JS uses + to concatenate strings, which causes all sorts of fun. //Javascript var a='5'; //string var b=5; //integer var c=a+b; //c is now '55' For sure, it's one of the reasons why PHP is fairly disliked. I'll use c# whenever I can and PHP only when I have to. I'm sure you know, but fortunately in PHP7 they have scalar type hinting so at least it's a step in the right direction. I've updated my local environments to have PHP7 and I've actually seen a pretty decent increase in performance. So at least PHP is getting better. I won't dare update on a live site just yet though, knowing PHP there's probably a pretty major exploit hiding in there somewhere. And with your JS example, this has happened to me more times than it should have :3 Quote [22:37:51] <&Yosodog> Problem is, everyone is too busy deciding which top gun character they are that no decision has been made BK in a nutshell Link to comment Share on other sites More sharing options...
dmjohnston Posted January 19, 2016 Share Posted January 19, 2016 If you do change the name, can you please leave the old one in there for a couple of days at least, to give people time to alter scripts? Thanks PHP is horrible with variable types. It's perfectly happy keeping an integer as a string, right up until you use it in a calculation. At which point, it will think of it as an integer and the result will be an integer. //PHP a='5'; //string b=5; //integer c=a+b; //c is now 10At least it's slightly better than Javascript. JS uses + to concatenate strings, which causes all sorts of fun. //Javascript var a='5'; //string var b=5; //integer var c=a+b; //c is now '55' If I get a chance later this week, I'll do a post in suggestions for nations, like I did with alliances. Yeah, I wasn't sure where to post the suggestion at. Quote ☾☆ Priest of Dio º¤ø„¤¤º°¨ ø„¸¸„¨ ø„¸¸„ø¤º°¨¨°º¤ø„¸¸„ø¤º°¨¨°º¤ø„¸ ¨°º¤ø„¸ GOD EMPEROR DIO BRANDO¨°º¤ø„¸ ¨°º¤ø„¸ DIO BRANDO GOD EMPEROR¨°º¤ø„¸ ¨°º¤ø„¤¤º°¨ ø„¸¸„¨ ø„¸¸„ø¤º°¨¨°º¤ø„¸¸„ø¤º°¨¨°º¤ø„¸ Link to comment Share on other sites More sharing options...
Valdoroth Posted March 4, 2016 Share Posted March 4, 2016 Can we get City Manager pages API? They're public access after all. Quote Link to comment Share on other sites More sharing options...
Kid Winchell Posted March 4, 2016 Share Posted March 4, 2016 Can we get City Manager pages API? They're public access after all. Does the City API not already provide all of that info? Quote Link to comment Share on other sites More sharing options...
niquedegraaff Posted October 25, 2016 Share Posted October 25, 2016 (edited) What about: https://politicsandwar.com/api/nations/allianceid=623 This would allow one to list nations filtered by the alliance. Currently I get a list of 5293 nations.. painfull to load. But only need 43 of them.I can filter them out myself of course but it slows down the loading process even more. Edited October 25, 2016 by niquedegraaff Quote Link to comment Share on other sites More sharing options...
niquedegraaff Posted October 25, 2016 Share Posted October 25, 2016 (edited) You can filter nations via alliance already https://politicsandwar.com/index.php?id=15&keyword=&cat=alliance&ob=score&od=ASC&maximum=15&minimum=0&search=Go I'm talking about the API here Not the frontend of the website. Also, Alex, since you publish public data, could you please enable CORS header from server-side? ( http://enable-cors.org ) Cross-Origin Resource Sharing (CORS) is a specification that enables truly open access across domain-boundaries. If you serve public content, please consider using CORS to open it up for universal JavaScript/browser access. Thank you Edited October 25, 2016 by niquedegraaff Quote Link to comment Share on other sites More sharing options...
Vack Posted October 25, 2016 Share Posted October 25, 2016 Could you add total land and total infra to the alliance API please? Useful for econ/ war data. Quote Link to comment Share on other sites More sharing options...
niquedegraaff Posted November 3, 2016 Share Posted November 3, 2016 (edited) He told me that API is low-priority. Don't expect anything soon .API can help alliances to build their private own tools. Edited November 3, 2016 by niquedegraaff Quote Link to comment Share on other sites More sharing options...
hidude45454 Posted November 25, 2016 Share Posted November 25, 2016 I know number of cities is already displayed on the single nation API, but could it also be added to the nations API? Or would that be too inconvenient? 2 Quote Link to comment Share on other sites More sharing options...
Restius Posted January 5, 2017 Share Posted January 5, 2017 (edited) I know part of the concern with all the API pulls is server overload, however what is some events were RSS instead of API? I cannot pretend to say whether or not RSS has less of a demand than API, but I think it would?Examples of RSS feeds: New Wars New Market Offers New Alliance Applicant In my train of thought, this could helpA. Reduce the workload of API requests coming into the serverB. Reduce the amount of hostile API attemptsC. Eliminate API requests from those who want to just get notifications to those who want to build information/graphs/etc. Edited January 5, 2017 by Restius Quote Link to comment Share on other sites More sharing options...
Shakyr Posted January 6, 2017 Share Posted January 6, 2017 I know part of the concern with all the API pulls is server overload, however what is some events were RSS instead of API? I cannot pretend to say whether or not RSS has less of a demand than API, but I think it would? Personally as a programmer, I'd rather JSON over XML, it's alot easier to work with and it compresses better. I also don't see what the difference would be, between a pull for an RSS feed and a pull for a JSON API call. Probably what really needs to happen is that certain bits of information are pre-calculated and "snapshotted", anywhere from once an hour to once a day, depending on the information and stored in a second database (along with the time they were snapshotted and any relevant values that make up the calculated values). It could even be dynamic in some cases, in that if someone loads a nation/alliance page, it does a quick check if the page has been snapshotted recently and if it hasn't been, takes a snapshot from the data that's been calculated already, to load the page. Might mean some pages take slightly longer to load, but people aren't likely to notice. The API can then run mostly off the second "snapshot" database and hopefully rarely dipping into the "real time" database. In addition, have all API requests linked to a user's nation (to track who is using the API). Alex can then track usage and if someone is then abusing the API (like if someone is accounting for 10-20% of all API calls), they can be messaged to explain and potentially either limited in some capacity or completely cut off. Quote Link to comment Share on other sites More sharing options...
Spooner Posted January 6, 2017 Share Posted January 6, 2017 Personally as a programmer, I'd rather JSON over XML, it's alot easier to work with and it compresses better. I also don't see what the difference would be, between a pull for an RSS feed and a pull for a JSON API call. As a non-programmer who stumbles around python tutorials to get his shit done, I prefer JSON over XML as well. Quote ☾☆ High Priest of Dio Link to comment Share on other sites More sharing options...
Administrators Alex Posted January 22, 2017 Author Administrators Share Posted January 22, 2017 Did a couple of API things: Added an API for singular wars. URL is here: https://politicsandwar.com/api/war/WARIDHERE You can find the ID for a war on most war-related page URLs, easiest is to look at a timeline or from the Wars API. Added an API for alliance applicants. URL is here: https://politicsandwar.com/api/applicants/ALLIANCEIDHERE This will return false if the alliance doesn't exist, or there are no applicants. Otherwise it will return true with a list of nations. Added city count to the nations API. Fixed some variable misinterpretation to remove quotes from integer values in a few places. Should make things (very, very slightly) faster to load 3 Quote Is there a bug? Report It | Not understanding game mechanics? Ask About It | Got a good idea? Suggest ItForums Rules | Game Link Link to comment Share on other sites More sharing options...
Yosodog Posted January 22, 2017 Share Posted January 22, 2017 (edited) Did a couple of API things: Added an API for singular wars. URL is here: https://politicsandwar.com/api/war/WARIDHERE You can find the ID for a war on most war-related page URLs, easiest is to look at a timeline or from the Wars API. Added an API for alliance applicants. URL is here: https://politicsandwar.com/applicants/ALLIANCEIDHERE This will return false if the alliance doesn't exist, or there are no applicants. Otherwise it will return true with a list of nations. Added city count to the nations API. Fixed some variable misinterpretation to remove quotes from integer values in a few places. Should make things (very, very slightly) faster to load I think your applicant API is wrong. Seems it's https://politicsandwar.com/api/applicants/AID oh god I'm in love with you. Is there any way to get damages on the war API? Edited January 22, 2017 by Yosodog Quote [22:37:51] <&Yosodog> Problem is, everyone is too busy deciding which top gun character they are that no decision has been made BK in a nutshell Link to comment Share on other sites More sharing options...
Administrators Alex Posted January 22, 2017 Author Administrators Share Posted January 22, 2017 I think your applicant API is wrong. Seems it's https://politicsandwar.com/api/applicants/AID oh god I'm in love with you. Is there any way to get damages on the war API? I might add damage totals and things, we'll see. But yes, you are correct, I forget the /api/ directory in my URL. Glad you figured it out Quote Is there a bug? Report It | Not understanding game mechanics? Ask About It | Got a good idea? Suggest ItForums Rules | Game Link Link to comment Share on other sites More sharing options...
Dalinar Posted January 23, 2017 Share Posted January 23, 2017 thanks alex Quote I will take responsibility for what I have done, if I must fall, I will rise each time a better man. Link to comment Share on other sites More sharing options...
niquedegraaff Posted January 27, 2017 Share Posted January 27, 2017 (edited) Thanks for working on the API again.I think you can reduce server load on API side by adding the ability to filter the nations list on alliance id and score. At the moment we get the full list of nations (a whopping 5018 !!), but most times we only need a few . Edited January 27, 2017 by niquedegraaff Quote Link to comment Share on other sites More sharing options...
Nobody III Posted July 9, 2018 Share Posted July 9, 2018 Thanks for all the APIs. They seem mostly complete, but I need a way to access the treaty web. Treaties could be included in the Alliance and Alliances APIs, or in a separate API. While a separate API would be slightly more convenient to me, it might make more sense to do it the other way. Either way, could you please include this information? It would be extremely helpful. Quote Link to comment Share on other sites More sharing options...
Popular Post Exar Kun -George Posted August 2, 2018 Popular Post Share Posted August 2, 2018 Bank trans api *cough cough* ❤️ 8 Quote Link to comment Share on other sites More sharing options...
Deja Posted October 18, 2018 Share Posted October 18, 2018 (edited) ^This! Edited October 18, 2018 by Deja Quote Link to comment Share on other sites More sharing options...
Christian Dahl Posted February 8, 2019 Share Posted February 8, 2019 ^ ^ We need a bank trans api 1 Quote Link to comment Share on other sites More sharing options...
Fairymoon Posted February 27, 2019 Share Posted February 27, 2019 Is anyone else having problems with the war api? Quote Link to comment Share on other sites More sharing options...
Leopold von Habsburg Posted March 5, 2019 Share Posted March 5, 2019 (edited) On 8/2/2018 at 4:08 PM, Pestilence said: Bank trans api *cough cough* ❤️ Just going to reiterate this request for the new year Edited March 5, 2019 by Leopold von Habsburg 1 Quote Link to comment Share on other sites More sharing options...
Radoje Posted March 6, 2019 Share Posted March 6, 2019 (edited) On 3/5/2019 at 8:15 PM, Leopold von Habsburg said: Just going to reiterate this request for the new year Going to re-reiterate this request for all the poor econ boys that had to sift through 3000 pages of transactions to send back safekeeping after the war. ❤️ btw great work on the war api, its smackaliciously sexy Edited March 6, 2019 by Radoje 2 1 Quote Link to comment Share on other sites More sharing options...
Arkin Posted March 22, 2020 Share Posted March 22, 2020 Battle Simulation API ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.