API Questions

Post Reply
mower
Posts: 6
Joined: 21 Feb 2021 13:22
Country: United Kingdom

API Questions

Post by mower »

I thought I'd seen a separate forum for API questions but can't find it again. Please do redirect me there if it exists!

I've been playing around a bit with the APIs as I wanted to create a map that highlighted who owned what zones in a given area. The first thing I noticed was that I can't get the same information from the API as the main site (unless I set the origin to turfgame.com which isn't going to work in a browser). For example, I can't get the zone polygons and the area for which I can retrieve zones is smaller. Is this deliberate?

I got something working locally though but when I tried hosting it I'm now running into CORS issues. I'm no web developer but I'm seeing a "PreflightMissingAllowOriginHeader" in Chrome which I think is because the API server is not returning an "Access-Control-Allow-Origin" header. Is this something that could be addressed or is it not the intention that the APIs can be used from other sites?

Thanks
mower
User avatar
DIProgan
Posts: 693
Joined: 21 Aug 2013 08:47
Country: Sweden
Contact:

Re: API Questions

Post by DIProgan »

Something like this? http://turf-aoi.matb.se/
Running the third-party project https://turfbridge.com
mower
Posts: 6
Joined: 21 Feb 2021 13:22
Country: United Kingdom

Re: API Questions

Post by mower »

Thanks for the reply - yes, that's the sort of thing. I see that it's proxying the APIs though. Would the developers consider opening them up for direct access from other origins?
HappyF
Zonemaker
Posts: 297
Joined: 08 Aug 2012 10:53
Country: Sweden
Contact:

Re: API Questions

Post by HappyF »

There is no public api to get polygons and I think it's deliberate to keep the traffic low.
Post Reply

Return to “General”