API/Tile status monitor

API/Tile status monitor

in API Development

Posted by: Drakma.1549

Drakma.1549

So, Cliff suggested it and I thought I’d give it a shot.

http://gw2stats.net/status/current

Shows the current status of the API. It provides some basic information on all of the APIs and the tile service.

http://gw2stats.net/status/api will show you how to integrate this data into your own programs.

I think the service is self-explanatory, but if there are any questions please feel free to contact me.

The services are polled every 15 seconds.

For informational sake, the host of gw2stats.net is located in New York City on a 1Gbps connection. It sits approximately 14 hops from the guildwars2 api servers (to the edge)

API/Tile status monitor

in API Development

Posted by: Drakma.1549

Drakma.1549

Status codes are as follows

“OK”: “No error was received : Completed successfully”
“UNREACHABLE”: “The host was unreachable : host may be down”
“DOWN”: “Host was reachable but API returned error : API may be down”
“PARTIAL”: “Only partial data was received”
“INCREASING PING”:“Ping to the API host has increased 100ms from last update”
“HIGH PING”:“Ping to the API host has reached a minimum of 750ms”
“SLOW RETRIEVE”: “API host and API are up : Data retrieval is over 3 seconds”

API/Tile status monitor

in API Development

Posted by: Cliff Spradlin.3512

Cliff Spradlin.3512

Lead Programmer

Thanks This will be helpful to all of us!

API/Tile status monitor

in API Development

Posted by: Iruwen.3164

Iruwen.3164

events.json is always on slow retrieve because of its size eh?

Iruwen Evillan, Human Mesmer on Drakkar Lake

API/Tile status monitor

in API Development

Posted by: Drakma.1549

Drakma.1549

events.json is always on slow retrieve because of its size eh?

Actually, it does go below 3000ms occasionally.

I will, however, be changing the “SLOW RETRIEVE” response to records per millisecond.

I needed a little data first to set the parameters and to tweak it.

API/Tile status monitor

in API Development

Posted by: Iruwen.3164

Iruwen.3164

Cool, thanks. [15chars]

Iruwen Evillan, Human Mesmer on Drakkar Lake

API/Tile status monitor

in API Development

Posted by: DarkSpirit.7046

DarkSpirit.7046

I see that you also call recipe_details.json. What parameters are you calling it with?

API/Tile status monitor

in API Development

Posted by: Drakma.1549

Drakma.1549

I see that you also call recipe_details.json. What parameters are you calling it with?

currently all of the *_details.json APIs are being called without any parameters. This results in an error being returned.

I will probably add some common parameters for the polling process. Something that should just “be” there all the time regardless.

But, as of right now, it just checks to make sure that the API is returning “something.”

As an added note, this does not do data validity. It just makes sure that it is up and returning data. If I have some spare time, I may add this.

If you have any additions you’d like to make please let me know here and I’ll see what I can do to add it in. I made this in about 30 minutes one night, so I am sure there may be bugs and things I overlooked.

API/Tile status monitor

in API Development

Posted by: DarkSpirit.7046

DarkSpirit.7046

Thanks. Talking about *_details.json, I don’t see the status for item_details.json, did you miss that?

Do you plan to release your source code?

(edited by DarkSpirit.7046)

API/Tile status monitor

in API Development

Posted by: Drakma.1549

Drakma.1549

Thanks. Talking about *_details.json, I don’t see the status for item_details.json, did you miss that?

Do you plan to release your source code?

Whoops. oversight on my side. Added now.

I could release the source, but I doubt it would be helpful at all tbh. You don’t honestly want my spaghetti code anyway.

(edited by Drakma.1549)

API/Tile status monitor

in API Development

Posted by: alforno.7132

alforno.7132

I’m getting an error "Uncaught SyntaxError: Unexpected token : " when calling the stats service. Seems to be caused by a recent change.

Javascript:

$.ajax({
dataType: “jsonp”,
url: “http://gw2stats.net/api/status.json”,
data: null,
success: function (data) {
a4.Base.log(data);
}
})
.fail(function () { alert(“Error getting Guild Wars 2 api status.”) });

I used to be able to call with dataType=“json”, but that stopped working this morning.

FYI: That error could indicate that the callback is not being returned with the json results. Remember that jsonp results are wrapped in a callback, not just raw json.

(edited by alforno.7132)

API/Tile status monitor

in API Development

Posted by: Drakma.1549

Drakma.1549

I’m getting an error "Uncaught SyntaxError: Unexpected token : " when calling the stats service. Seems to be caused by a recent change.

Javascript:

$.ajax({
dataType: “jsonp”,
url: “http://gw2stats.net/api/status.json”,
data: null,
success: function (data) {
a4.Base.log(data);
}
})
.fail(function () { alert(“Error getting Guild Wars 2 api status.”) });

I used to be able to call with dataType=“json”, but that stopped working this morning.

FYI: That error could indicate that the callback is not being returned with the json results. Remember that jsonp results are wrapped in a callback, not just raw json.

This is just raw json. I haven’t changed anything since release as far as status.json is concerned. I will, however, dig into this and see if there is something on my end.

API/Tile status monitor

in API Development

Posted by: Tom Deluxe.9105

Tom Deluxe.9105

I’m getting an error "Uncaught SyntaxError: Unexpected token : " when calling the stats service. Seems to be caused by a recent change.

Javascript:

$.ajax({
dataType: “jsonp”,
url: “http://gw2stats.net/api/status.json”,
data: null,
success: function (data) {
a4.Base.log(data);
}
})
.fail(function () { alert(“Error getting Guild Wars 2 api status.”) });

I used to be able to call with dataType=“json”, but that stopped working this morning.

FYI: That error could indicate that the callback is not being returned with the json results. Remember that jsonp results are wrapped in a callback, not just raw json.

This is just raw json. I haven’t changed anything since release as far as status.json is concerned. I will, however, dig into this and see if there is something on my end.

You need to make a JSONP capable API, parsing a GET “callback” argument that has the name of the function we want you to wrap your data around.

Why?

If we want to retrieve your API data from a browser with JavaScript, browsers won’t allow scripts to get data directly from another URL different from the one they are hosted in because of the same origin policy.

Additionally, remember also to set the value of your “Content-Type” response header to “application/json”

The only solution to pass this restriction for us would be to use a proxy server that properly wraps the API data into a JS function, but not everyone is going to rent a server just for this xD (well, YQL has a public service to handle this kind of situations…)

Edit:

also enabling CORS in your server (like ANet does) would be even better.

Edit 2:

in the mean time we can use something like this.

(edited by Tom Deluxe.9105)

API/Tile status monitor

in API Development

Posted by: Drakma.1549

Drakma.1549

CORS should be enabled.

Callbacks now supported.

I did this on my phone in the car. If something does not work, blame the bumpy road.

API/Tile status monitor

in API Development

Posted by: Tom Deluxe.9105

Tom Deluxe.9105

CORS should be enabled.

Callbacks now supported.

I did this on my phone in the car. If something does not work, blame the bumpy road.

Great! Both methods work now ;-)

API/Tile status monitor

in API Development

Posted by: yakobu.4183

yakobu.4183

So… I’m waiting for the Status API Status API.
Inspired by http://isdownforeveryoneorjustmedownforeveryoneorjustme.com

MBP 13", Early 2011, 2.7 GHz i7, 8 GB 1333 MHz DDR3, Intel HD Graphics 3000 512 MB, OS X 10.8.2

API/Tile status monitor

in API Development

Posted by: Khisanth.2948

Khisanth.2948

Looks like there is another situation this is going to have to account for. Right now Events is completely down for all servers except Stormbluff Isles. Even on SBI it seems to be partially up(only for Lion’s Arch and Labrynthine Cliffs) but because of that the status is misreported as Okay. I guess it should be Partial in this case

API/Tile status monitor

in API Development

Posted by: Drakma.1549

Drakma.1549

I’ll see what I can do to expand events to include all servers.

API/Tile status monitor

in API Development

Posted by: Drakma.1549

Drakma.1549

Still looking at how I can expand the events.json to check every server…

In the mean time I have added the new servers related to data assets to the API

It now includes:
https://render.guildwars2.com
files.json