ECO Web API

Messages
1
Likes
1
#1
Was looking through the files and managed to compile a list of "possibly" useful JSON API stuff

URL

Response

http://IP:PORT/info

{
"Address": "IP",
"GamePort": 30877,
"WebPort": 45090,
"Description": "Description",
"Ping": 0,
"OnlinePlayers": 2,
"TotalPlayers": 2,
"TimeSinceStart": 11790.33674666666,
"TimeLeft": 2580209.711576574,
"Animals": 6793,
"Plants": 543220,
"Laws": 1,
"WorldSize": "2.07km²",
"Version": "0.7.1.2 beta",
"EconomyDesc": "0 trades, 0 contracts",
"SkillSpecialization": "Low."
}

http://IP:PORT/api/v1/analysis/playstyles

[
{
"Username": "sankex",
"Playstyle": "labor",
"Rating": 0.0,
"ContributingStats": []
},
{
"Username": "The Messiah",
"Playstyle": "labor",
"Rating": 0.0,
"ContributingStats": []
}
]

http://IP:PORT/api/v1/laws

[
{
"Guid": "057c4a87-1932-4f21-8bbd-6e616caefc4a",
"Title": "Citizenship",
"Description": "You must play on this server for 2 hours before becoming a citizen.",
"InEffect": true,
"LawText": "<section><section><section>When attempting to Propose a Vote</section><section>or Vote</section><section><section>If Play (hours) actions where (performed by you) < 2<section>Then prevent</section></section><section>Otherwise allow</section></section></section></section>",
"VotesYes": 0,
"VotesNo": 0,
"VotedYes": [],
"VotedNo": [],
"VoteProposedTime": 0.59880938396624472,
"VoteEndTime": 0.59919905485232072,
"VoteEndsInSeconds": -41635.213793372845,
"State": "Passed"
}
]

http://IP:PORT/api/v1/laws/activity

[
{
"Law": {
"Guid": "057c4a87-1932-4f21-8bbd-6e616caefc4a",
"Title": "Citizenship",
"Description": "You must play on this server for 2 hours before becoming a citizen.",
"InEffect": true,
"LawText": "<section><section><section>When attempting to Propose a Vote</section><section>or Vote</section><section><section>If Play (hours) actions where (performed by you) < 2<section>Then prevent</section></section><section>Otherwise allow</section></section></section></section>",
"VotesYes": 0,
"VotesNo": 0,
"VotedYes": [],
"VotedNo": [],
"VoteProposedTime": 0.59880938396624472,
"VoteEndTime": 0.59919905485232072,
"VoteEndsInSeconds": -12215.038879864973,
"State": "Passed"
},
"Events": [
{
"LawGuid": "057c4a87-1932-4f21-8bbd-6e616caefc4a",
"EventType": "Proposed",
"EventTime": 0.59880938396624472,
"Players": [
null
],
"Summary": "Proposed"
},
{
"LawGuid": "057c4a87-1932-4f21-8bbd-6e616caefc4a",
"EventType": "Passed",
"EventTime": 0.59919905485232072,
"Players": [],
"Summary": "Passed"
}
]
}
]

http://IP:PORT/api/v1/analysis/discussions/suggest

[
{
"EventTitle": "Law Proposed: Citizenship",
"EventData": {
"ChatLogSnippets": [],
"Graphs": [
{
"Keys": [
[
"Humans",
"All",
"Propose a Vote"
]
],
"TimeMin": 0.0,
"TimeMax": 0.13559769241898148
}
],
"Maps": []
},
"Discussion": {
"Guid": "d0f93fd9-0494-4cdf-b496-826d10ae4367",
"Title": "Evaluating The Proposed Law 'Citizenship'",
"Description": "Use data from the proposed law to evaluate its potential effects on the ecosystem. (MS-LS2-4).",
"Activities": [
{
"Format": "Data",
"Title": "Law Proposal",
"Description": "Review the proposed law below.\n\nCitizenship\nYou must play on this server for 2 hours before becoming a citizen.",
"Data": {
"ChatLogSnippets": [],
"Graphs": [
{
"Keys": [
[
"Humans",
"All",
"Propose a Vote"
]
],
"TimeMin": 0.0,
"TimeMax": 0.13559769241898148
},
{
"Keys": [
[
"Humans",
"All",
"Vote"
]
],
"TimeMin": 0.0,
"TimeMax": 0.13559769241898148
}
],
"Maps": []
}
},
{
"Format": "Reflection",
"Title": "Reflect",
"Description": "In your own words, what do you think this law is trying to achieve? Why?\nDo you believe this law will achieve its goals? Why or why not?",
"Data": {
"ChatLogSnippets": [],
"Graphs": [],
"Maps": []
}
},
{
"Format": "Reflection",
"Title": "Reflect Together",
"Description": "With a partner or small group, discuss your reflections and try to identify:\n* Do you all agree on whether the law will achieve its goals? Why or why not?\n* What evidence supports the proposed law’s claims? How convincing is it?\n* What additional evidence would you need to see to convince you that this law will achieve its goals?",
"Data": {
"ChatLogSnippets": [],
"Graphs": [],
"Maps": []
}
},
{
"Format": "Reflection",
"Title": "Intended Causes and Outcomes",
"Description": "In the space below, list the causes of the problem identified in the original law on the left.Then write the intended outcomes of the law to the right.",
"Data": {
"ChatLogSnippets": [],
"Graphs": [],
"Maps": []
}
},
{
"Format": "Reflection",
"Title": "Unexpected Causes and Outcomes",
"Description": "Consider whether there are other possible causes of the problem and write these in the column on the left. For each cause, what will the effect be on the ecosystem if the law is enacted? Are there unexpected outcomes that may benefit or damage the ecosystem?",
"Data": {
"ChatLogSnippets": [],
"Graphs": [],
"Maps": []
}
},
{
"Format": "Class Discussion",
"Title": "Class Discussion",
"Description": "What problem is this law attempting to solve?\nHow well does the proposed law use evidence to justify its action?\nDo you think the law will achieve its intended goals? Why or why not?\nWhat are other potential causes of the problem this law is trying to solve?\nWhat possible effects could occur if one of these alternative causes is responsible for the problem?\nWhat evidence could you use to determine if one of these other causes is responsible for the problem?\nHow “risky” do you think this law is? Why?\nWhat changes (if any) would you make now in Eco?",
"Data": {
"ChatLogSnippets": [],
"Graphs": [],
"Maps": []
}
},
{
"Format": "Reflection",
"Title": "Predictions and Future Actions",
"Description": "After considering the discussion today, what do you personally think will happen if this law is enacted? Why?\nWhat next steps do you want to take the next time you play the game?",
"Data": {
"ChatLogSnippets": [],
"Graphs": [],
"Maps": []
}
}
]
}
}
]

http://IP:PORT/api/v1/elections/activity

[]

http://IP:PORT/api/v1/elections/current

null

http://IP:PORT/api/v1/elections/previous

[]

http://IP:PORT/api/v1/elections/townhallconstructed

true

http://IP:PORT/api/v1/elections/iselectionrunning

false

  
 
Messages
30
Likes
11
#2
THANK YOU, I am making a tool right now what uses the domain not IP to get the server, if the server api includes it's IP you just updates my tool thank you

Update

Address:port/info

{
"Address": "IP",
"GamePort": 30877,
"WebPort": 45090,
"Description": "Description",
"Ping": 0,
"OnlinePlayers": 2,
"TotalPlayers": 2,
"TimeSinceStart": 11790.33674666666,
"TimeLeft": 2580209.711576574,
"Animals": 6793,
"Plants": 543220,
"Laws": 1,
"WorldSize": "2.07km²",
"Version": "0.7.1.2 beta",
"EconomyDesc": "0 trades, 0 contracts",
"SkillSpecialization": "Low."
}



I think it only returns IP if NAT is enabled

{
"GamePort": 3000,
"WebPort": 83,
"Description": "#######",
"Ping": 0,
"OnlinePlayers": 0,
"TotalPlayers": 4,
"TimeSinceStart": 148772.94474379678,
"TimeLeft": 10219227.188922646,
"Animals": 2430,
"Plants": 100893,
"Laws": 1,
"Leader": "#######",
"WorldSize": "0.52km²",
"Version": "0.7.1.2 beta",
"EconomyDesc": "0 trades, 0 contracts",
"SkillSpecialization": "Medium."
}

See Address is missing, dam I wanted to use that so I didn't need to use a domain to IP service lol

---- Automatically Merged Double Post ----

http://IP:pORT/api/v1/plugins

{
"Message": "An error has occurred."
}

 
Last edited:

Rexzooly

Copper
Mod Dev
Messages
85
Likes
21
#5
http://ip:port/api/v1/chat/{Username}


This will return the chat for the username only, unless /chat that returns everything including login and status of items what are printed in chat this only returns chat messages from what I can see.
 

ClayC

Copper
Mod Dev
Messages
57
Likes
38
#6
Since this seems to be of interest to everyone, I will gather the list of endpoints an eco server has and add them to a page on my website, will try to keep it up to date with any changes done by SLG.

A link will be added here once I have it done,
 

Rexzooly

Copper
Mod Dev
Messages
85
Likes
21
#7
I woud love to see a full api list to see what we have to play with, sadly I might have to try block the chat option as my users don't like it but if it was for viewing of admins only it would be epic.

How did you end up finding that gem
 

ClayC

Copper
Mod Dev
Messages
57
Likes
38
#8
I woud love to see a full api list to see what we have to play with, sadly I might have to try block the chat option as my users don't like it but if it was for viewing of admins only it would be epic.

How did you end up finding that gem
I do have dev tier, I have access to all source code etc. I also brought this issue up to the devs around 2 months ago, and they should patch it soon
 
Last edited:

Rexzooly

Copper
Mod Dev
Messages
85
Likes
21
#9
I do have dev tier but I am still awaiting for it to be added so they say it's manually added but it's been a while might email them.

Ya I can see it been a little problem maybe them added a token in the control panel so then we can still access it with a url without logging in but have it still private.
 

Rexzooly

Copper
Mod Dev
Messages
85
Likes
21
#11
What do you mean by double in your api list ? and the test button seems not to work for me or just yet anyway :)
 

ClayC

Copper
Mod Dev
Messages
57
Likes
38
#12
What do you mean by double in your api list ? and the test button seems not to work for me or just yet anyway :)
test button will ping the ctk server to retrieve actual data. (at the moment it is being blocked because the request is going from https to http, have to fix this ;) )
 

Rexzooly

Copper
Mod Dev
Messages
85
Likes
21
#13
I got the double to work just adding a ?startDay=#, # means a number so I guessing double means digit/number ?
 

Rexzooly

Copper
Mod Dev
Messages
85
Likes
21
#15
That just confused me more lol but seems ?startDay=# seems to work for me so I will use it like that for now :)
 
Top Bottom