Cenna Posted December 27, 2015 Share Posted December 27, 2015 It'd be great if there was a way to see the time line of a war from the nation your looking at rather then have to go through the huge list of current wars Quote The Caledonian Empire--In Space Link to comment Share on other sites More sharing options...
martbhell Posted January 1, 2016 Share Posted January 1, 2016 Could we have an alliances API in the same way that we have a nations API? 1 call for all alliance data would be better than having to keep the list up to date and pull them all separately. Something other than https://politicsandwar.com/api/alliance/id=621 ? I would personally like to be able to get a list of alliances Anyway, I just want to say thanks to Sheepy for having this API part of the game. I've had much fun and learnt a lot of programming working with the API. p.s. http://politicsandwar.com/api/nation/id=30063another escape character issue in the json making it invalid. Quote Link to comment Share on other sites More sharing options...
Dan77 Posted January 1, 2016 Share Posted January 1, 2016 Could we just remove all the prenames and titles from the API? Surely nobody ever uses them anyway. All these apostrophe's messing up the data. 2 Quote Link to comment Share on other sites More sharing options...
Kid Winchell Posted January 2, 2016 Share Posted January 2, 2016 Could we just remove all the prenames and titles from the API? Surely nobody ever uses them anyway. All these apostrophe's messing up the data. Or, y'know, sheepy could just properly format the JSON. Apostrophes don't need to be escaped, only quotes. 1 Quote Link to comment Share on other sites More sharing options...
Yosodog Posted January 3, 2016 Share Posted January 3, 2016 Or, and I don't want to sound pretentious or demeaning, have the computer do it. I don't know the database setup for the game but I'd assume it would go like this: $conn = connect(); $query = $conn->prepare("SELECT * FROM nations WHERE id=?"); $query->bind_param("i", $_GET['id']); $query->execute(); $result = $query->get_result(); echo "<pre>"; echo json_encode($result->fetch_assoc(), JSON_PRETTY_PRINT); echo "</pre>"; I don't know if it is already done this way, but it doesn't look like it (at least in the nation/city/alliance). This would also make it easier to have APIs for other things *nudge nudge* war *nudge* 1 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...
Kid Winchell Posted January 9, 2016 Share Posted January 9, 2016 A list of all alliances would be nice, as would listing all members on the individual alliance page. Also an about page that lists all of the API pages (and probably a description of what the API is/does for people who wander there and don't know what they've found). Quote Link to comment Share on other sites More sharing options...
dmjohnston Posted January 11, 2016 Share Posted January 11, 2016 The City API got changed, they removed the "data" and "stats" tags, is that going to happen to nation and alliance as well? I'll need to change scripts if it does. Quote ☾☆ Priest of Dio º¤ø„¤¤º°¨ ø„¸¸„¨ ø„¸¸„ø¤º°¨¨°º¤ø„¸¸„ø¤º°¨¨°º¤ø„¸ ¨°º¤ø„¸ GOD EMPEROR DIO BRANDO¨°º¤ø„¸ ¨°º¤ø„¸ DIO BRANDO GOD EMPEROR¨°º¤ø„¸ ¨°º¤ø„¤¤º°¨ ø„¸¸„¨ ø„¸¸„ø¤º°¨¨°º¤ø„¸¸„ø¤º°¨¨°º¤ø„¸ Link to comment Share on other sites More sharing options...
Yosodog Posted January 11, 2016 Share Posted January 11, 2016 The City API got changed, they removed the "data" and "stats" tags, is that going to happen to nation and alliance as well? I'll need to change scripts if it does. Probably https://politicsandwar.com/forums/index.php?/topic/10444-city-json-api-a-bit-sad-data-there-twice-and-html-code/?p=188729 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 11, 2016 Author Administrators Share Posted January 11, 2016 Or, and I don't want to sound pretentious or demeaning, have the computer do it. I don't know the database setup for the game but I'd assume it would go like this: $conn = connect(); $query = $conn->prepare("SELECT * FROM nations WHERE id=?"); $query->bind_param("i", $_GET['id']); $query->execute(); $result = $query->get_result(); echo "<pre>"; echo json_encode($result->fetch_assoc(), JSON_PRETTY_PRINT); echo "</pre>"; I don't know if it is already done this way, but it doesn't look like it (at least in the nation/city/alliance). This would also make it easier to have APIs for other things *nudge nudge* war *nudge* Yeah, I just learned about this recently to be honest with you. And I'm working on updating all the pages to match this format, and it does make it much, much easier. 1 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...
Administrators Alex Posted January 11, 2016 Author Administrators Share Posted January 11, 2016 Added a couple of new pages: https://politicsandwar.com/api/alliances/ Similar to the nations page https://politicsandwar.com/api/tradeprice/resource=XXX Where XXX is your resource name. Defaults to steel if none provided. 2 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...
Dwynn Posted January 11, 2016 Share Posted January 11, 2016 Added a couple of new pages: https://politicsandwar.com/api/alliances/ Similar to the nations page https://politicsandwar.com/api/tradeprices/resource=XXX Where XXX is your resource name. Defaults to steel if none provided. Second link should be https://politicsandwar.com/api/tradeprice/resource=XXX Quote He's right, I'm such a stinker. Play my exceptional game! Link to comment Share on other sites More sharing options...
Administrators Alex Posted January 11, 2016 Author Administrators Share Posted January 11, 2016 Second link should be https://politicsandwar.com/api/tradeprice/resource=XXX I don't know what you're talking about... 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...
Shakyr Posted January 12, 2016 Share Posted January 12, 2016 Sheepy, could I have some clarification as to what you mean by highest/lowest buy? It seems to me that it's running off 'totalvalue' as opposed to 'price', with the latter actually being more useful (as it would then give you a min/max to go with the average). { "resource": "steel", "avgprice": "2868", "marketindex": "18,323", "highestbuy": { "date": "2016-01-11 16:23:16", "nationid": "21386", "amount": "4910", "price": "2694", "totalvalue": 13227540 }, "lowestbuy": { "date": "2016-01-11 18:36:54", "nationid": "28939", "amount": "34", "price": "2750", "totalvalue": 93500 } }Also, with all APIs, is the API data generated at that point in time, or is it cached and only updated once an hour or something like that? Quote Link to comment Share on other sites More sharing options...
dmjohnston Posted January 12, 2016 Share Posted January 12, 2016 Could we also have the sell high and low? Quote ☾☆ Priest of Dio º¤ø„¤¤º°¨ ø„¸¸„¨ ø„¸¸„ø¤º°¨¨°º¤ø„¸¸„ø¤º°¨¨°º¤ø„¸ ¨°º¤ø„¸ GOD EMPEROR DIO BRANDO¨°º¤ø„¸ ¨°º¤ø„¸ DIO BRANDO GOD EMPEROR¨°º¤ø„¸ ¨°º¤ø„¤¤º°¨ ø„¸¸„¨ ø„¸¸„ø¤º°¨¨°º¤ø„¸¸„ø¤º°¨¨°º¤ø„¸ Link to comment Share on other sites More sharing options...
Spooner Posted January 12, 2016 Share Posted January 12, 2016 @DMJ & @Shak It lists the current lowest sell, and highest buy prices posted on the market. It's functioning correctly. 2 Quote ☾☆ High Priest of Dio Link to comment Share on other sites More sharing options...
Shakyr Posted January 12, 2016 Share Posted January 12, 2016 Trade Prices API not currently working for me, says page not found. Quote Link to comment Share on other sites More sharing options...
Yosodog Posted January 12, 2016 Share Posted January 12, 2016 Trade Prices API not currently working for me, says page not found. It should be 'tradeprice' https://politicsandwar.com/api/tradeprice/resource=steelSheepy must've linked the wrong link 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...
Shakyr Posted January 12, 2016 Share Posted January 12, 2016 It should be 'tradeprice' https://politicsandwar.com/api/tradeprice/resource=steelSheepy must've linked the wrong link Thanks Quote Link to comment Share on other sites More sharing options...
Kid Winchell Posted January 13, 2016 Share Posted January 13, 2016 Everything on the trade price page except for the resource name and highest/lowest buy date are numbers. So why are the totalvalues for the highest/lowest buy the only things that are served as integers? Quote Link to comment Share on other sites More sharing options...
Dwynn Posted January 13, 2016 Share Posted January 13, 2016 Everything on the trade price page except for the resource name and highest/lowest buy date are numbers. So why are the totalvalues for the highest/lowest buy the only things that are served as integers? date wouldn't be integer, it's a string due to formatting Also when there's no data the fields that are strings show "null" instead of integers, while totalvalue displays 0 as integer. Quote He's right, I'm such a stinker. Play my exceptional game! Link to comment Share on other sites More sharing options...
dmjohnston Posted January 17, 2016 Share Posted January 17, 2016 Can we please get the number of defensive slots open added to the nation feed? Quote ☾☆ Priest of Dio º¤ø„¤¤º°¨ ø„¸¸„¨ ø„¸¸„ø¤º°¨¨°º¤ø„¸¸„ø¤º°¨¨°º¤ø„¸ ¨°º¤ø„¸ GOD EMPEROR DIO BRANDO¨°º¤ø„¸ ¨°º¤ø„¸ DIO BRANDO GOD EMPEROR¨°º¤ø„¸ ¨°º¤ø„¤¤º°¨ ø„¸¸„¨ ø„¸¸„ø¤º°¨¨°º¤ø„¸¸„ø¤º°¨¨°º¤ø„¸ Link to comment Share on other sites More sharing options...
Administrators Alex Posted January 18, 2016 Author Administrators Share Posted January 18, 2016 Sheepy, could I have some clarification as to what you mean by highest/lowest buy? It seems to me that it's running off 'totalvalue' as opposed to 'price', with the latter actually being more useful (as it would then give you a min/max to go with the average). { "resource": "steel", "avgprice": "2868", "marketindex": "18,323", "highestbuy": { "date": "2016-01-11 16:23:16", "nationid": "21386", "amount": "4910", "price": "2694", "totalvalue": 13227540 }, "lowestbuy": { "date": "2016-01-11 18:36:54", "nationid": "28939", "amount": "34", "price": "2750", "totalvalue": 93500 } }Also, with all APIs, is the API data generated at that point in time, or is it cached and only updated once an hour or something like that? It's generated point in time. Could we also have the sell high and low? It actually shows the lowest sell and the highest buy. I should change the name of the latter. Everything on the trade price page except for the resource name and highest/lowest buy date are numbers. So why are the totalvalues for the highest/lowest buy the only things that are served as integers? I don't know, it's using json_encode, I presume PHP doesn't want them to be integers. Or something. 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 18, 2016 Share Posted January 18, 2016 I don't know, it's using json_encode, I presume PHP doesn't want them to be integers. Or something. Is it stored as an integer or a string in the database? Could also just be PHP being horrible with managing variable types smh 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 18, 2016 Share Posted January 18, 2016 Can we please get the number of defensive slots open added to the nation feed? Also, vacation mode added to nation api? Quote ☾☆ Priest of Dio º¤ø„¤¤º°¨ ø„¸¸„¨ ø„¸¸„ø¤º°¨¨°º¤ø„¸¸„ø¤º°¨¨°º¤ø„¸ ¨°º¤ø„¸ GOD EMPEROR DIO BRANDO¨°º¤ø„¸ ¨°º¤ø„¸ DIO BRANDO GOD EMPEROR¨°º¤ø„¸ ¨°º¤ø„¤¤º°¨ ø„¸¸„¨ ø„¸¸„ø¤º°¨¨°º¤ø„¸¸„ø¤º°¨¨°º¤ø„¸ Link to comment Share on other sites More sharing options...
Shakyr Posted January 19, 2016 Share Posted January 19, 2016 It actually shows the lowest sell and the highest buy. I should change the name of the latter.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 Is it stored as an integer or a string in the database? Could also just be PHP being horrible with managing variable types smhPHP 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' Also, vacation mode added to nation api?If I get a chance later this week, I'll do a post in suggestions for nations, like I did with alliances. 1 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.