These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
12Next page
 

API Servers: HTTP 403 on API error change

Author
Cyerus
University of Caille
Gallente Federation
#1 - 2013-09-18 13:55:34 UTC  |  Edited by: Cyerus
This is a copy of this post. Created a seperate thread to make sure this problem receives the attention it deserves.

Up until the API server update of Odyssey 1.0.10 (see this thread) we had a clear difference between the API errors and HTTP errors. API errors show what's wrong with the request you are doing, while HTTP errors generally meant something was "wrong" with the API servers. This made it possible to run different pieces of code by checking the HTTP errors, and if an HTTP 200 was returned (means request OK), you'd be able to check the replied XML for any API error codes and present the user with a detailed explanation of what was wrong.

Currently all I'll receive back in case of an API error (examples like invalid characterID or invalid API details or perhaps the API access has been disabled because of an upcoming patch) is the HTTP 403 error. In my case this error would make the script stop functioning, as I don't want to continue querying if the API servers are crumbling. True, this behaviour could be changed but what do I do instead?

Should I assume the API servers are temporarily disabled and stop querying, but continue in a few minutes?
Or should I disable the user and list a long list of stuff that could be wrong the API details he used?


In the end the use of the HTTP 403 header is correct; The API server can't give you the requested data as some (if not all) of your access keys are invalid / expired. But is that really the behaviour we'd want from the current API system? Instead, I'd like to present the users with a clear description of what went wrong (the old situation). Preferably with an HTTP 200 code as the request should always be accepted (exception in API downtime or patchday) and send back an XML with an errorcode if something went wrong.

So basically use the HTTP errorcodes for the service, and use the API errorcodes for it's content.


Therefor I'd like to ask you to revert the recent HTTP 403 errorcode on API errors change.

Thanks for reading, Cyerus.


ps. It would also be an improvement if we can actually retrieve the XML page containing the API error when receiving an HTTP 403 errorcode. Currently it only displays a simply white page with the HTTP 403 errorcode as content. Personally I'm not a big fan of this solution, but I'll list it here as it would still be a big step forward compared to the current situation.
Innominate
KarmaFleet
Goonswarm Federation
#2 - 2013-09-18 14:10:57 UTC
Determining invalid API keys from API errors has been a problem for as long as I can remember. The switch to HTTP error codes has only made it worse. Given CCP's requests in the past(granted, I haven't seen one recently) to minimize error rates, this is problematic.

It would be nice to finally have working and trustworthy API error reporting and I think Cyerus is dead on as to the best way for it to behave.
Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#3 - 2013-09-18 14:23:49 UTC
Completely supported.

Meaningful error messages are needed.

I can understand thowing a http error message, but there needs to be something in the body saying /what/ the problem is.

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter

Peter Powers
Terrorists of Dimensions
HORSE-KILLERS
#4 - 2013-09-18 14:57:25 UTC
Currently it is impossible to make a meaningfull error handling with this, i've had users reporting this as bug to my api libraries (Pheal/PhealNG/EAAL) because they could not believe that this was related to behaviour of the API.

Meaning: i agree with Cyerus. do something, CCP.

3rdPartyEve.net - your catalogue for 3rd party applications

xHjfx
The Legion of Spoon
Curatores Veritatis Alliance
#5 - 2013-09-18 19:19:12 UTC
Cyerus wrote:
This is a copy of this post. Created a seperate thread to make sure this problem receives the attention it deserves.

Up until the API server update of Odyssey 1.0.10 (see this thread) we had a clear difference between the API errors and HTTP errors. API errors show what's wrong with the request you are doing, while HTTP errors generally meant something was "wrong" with the API servers. This made it possible to run different pieces of code by checking the HTTP errors, and if an HTTP 200 was returned (means request OK), you'd be able to check the replied XML for any API error codes and present the user with a detailed explanation of what was wrong.

Currently all I'll receive back in case of an API error (examples like invalid characterID or invalid API details or perhaps the API access has been disabled because of an upcoming patch) is the HTTP 403 error. In my case this error would make the script stop functioning, as I don't want to continue querying if the API servers are crumbling. True, this behaviour could be changed but what do I do instead?

Should I assume the API servers are temporarily disabled and stop querying, but continue in a few minutes?
Or should I disable the user and list a long list of stuff that could be wrong the API details he used?


In the end the use of the HTTP 403 header is correct; The API server can't give you the requested data as some (if not all) of your access keys are invalid / expired. But is that really the behaviour we'd want from the current API system? Instead, I'd like to present the users with a clear description of what went wrong (the old situation). Preferably with an HTTP 200 code as the request should always be accepted (exception in API downtime or patchday) and send back an XML with an errorcode if something went wrong.

So basically use the HTTP errorcodes for the service, and use the API errorcodes for it's content.


Therefor I'd like to ask you to revert the recent HTTP 403 errorcode on API errors change.

Thanks for reading, Cyerus.


ps. It would also be an improvement if we can actually retrieve the XML page containing the API error when receiving an HTTP 403 errorcode. Currently it only displays a simply white page with the HTTP 403 errorcode as content. Personally I'm not a big fan of this solution, but I'll list it here as it would still be a big step forward compared to the current situation.


I could understand if CCP meant that error 40x was their API servers failing.... but they you get Internal server error 500 if something major goes... Error 403 means you either got a bad key or a bad access mask.

Invalid characterID should come back as bad request IMHO.

It's no where near doom and gloom, just not as informative as the old system - you just actually have to bother to re code for the changes.

CCP broadsided us with the change (we were using Pheal for our project) and encountered the error - a few lines later and it was sorted.
Rob Crowley
State War Academy
#6 - 2013-09-18 19:28:54 UTC
xHjfx wrote:
It's no where near doom and gloom, just not as informative as the old system - you just actually have to bother to re code for the changes.

The issue here is that no matter how hard you recode, the new system has way less functionality than the old one for no apparent reason. It's not like the old one didn't work fine.

There's nothing wrong as such with changing to http error codes and having us recode a bit, but there's no excuse for losing information in the process.
Gaius Henry
The Scope
Gallente Federation
#7 - 2013-09-18 19:30:08 UTC
No need to repost, devs are already working on it.

CCP Prism X wrote:
Just got back from vacation. I see there are some annoyances still out there. I'll take a look as soon as I've reaccustomed to having to work for a payheck. Blink

xHjfx
The Legion of Spoon
Curatores Veritatis Alliance
#8 - 2013-09-18 21:19:16 UTC
Rob Crowley wrote:
xHjfx wrote:
It's no where near doom and gloom, just not as informative as the old system - you just actually have to bother to re code for the changes.

The issue here is that no matter how hard you recode, the new system has way less functionality than the old one for no apparent reason. It's not like the old one didn't work fine.

There's nothing wrong as such with changing to http error codes and having us recode a bit, but there's no excuse for losing information in the process.


The old one caused alot of load on the API servers, while I agree it isn't ideal in any manner at the moment - it isn't a showstopper either.
Cyerus
University of Caille
Gallente Federation
#9 - 2013-09-18 22:35:54 UTC  |  Edited by: Cyerus
Gaius Henry wrote:
No need to repost, devs are already working on it.

CCP Prism X wrote:
Just got back from vacation. I see there are some annoyances still out there, I'll take a look as soon as I've reaccustomed to having to work for a payheck. Blink


Spoke with PrismX a bit ago who said it wasn't on his list just yet. In other words: soon(tm). This problem needs to be in the spotlight in order to be looked at, as it's a major pain in it's current form.


xHjfx wrote:
Rob Crowley wrote:
xHjfx wrote:
It's no where near doom and gloom, just not as informative as the old system - you just actually have to bother to re code for the changes.

The issue here is that no matter how hard you recode, the new system has way less functionality than the old one for no apparent reason. It's not like the old one didn't work fine.

There's nothing wrong as such with changing to http error codes and having us recode a bit, but there's no excuse for losing information in the process.


The old one caused alot of load on the API servers, while I agree it isn't ideal in any manner at the moment - it isn't a showstopper either.

Recoding isn't that easy, as we are missing information. Nothing is solid anymore, it has become guesswork. For example: Does a 403 mean that the user isn't part of fw using FacWarStats call, or is the characterId wrong?
What about spam control? Can't really stop quering if the API 904 is shown as an HTTP 403...

Internally the API errorcoded are still used, they just aren't displayed anymore, which I hope to change.
xHjfx
The Legion of Spoon
Curatores Veritatis Alliance
#10 - 2013-09-19 04:37:37 UTC  |  Edited by: xHjfx
If the characterID was returned on the character list and as part of the same call you are requesting factional warfare stats - you can assume that the 400 Bad request is related to not being enrolled.

Granted it puts more onus on the coder for implementing extra logic to check the situation but I wouldn't call it guesswork either.

If it's a 403 Forbidden, then they don't have the correct access mask to request that information.

I did say it wasn't ideal but it isn't a great task to reliably work around it either...
Shin Chogan
Federal Navy Academy
Gallente Federation
#11 - 2013-09-20 08:43:18 UTC
I didn't like it at first but I've actually found it has simplified TEA somewhat.

Basic process now is :

1/ get Keyinfo - 403 at this point is expired or non existant key so stop and mark bad in DB & never check again using the automatic poll
2/ check apimask is appropriate based on mask returned in xml from keyinfo - currently continue processing but in future may change this to stop processesing rules.
3/ get corpinfo, charactersheet, characterinfo, facwarstatus if any of these return a 403 then don't try and evaluate a TEA rule based on the info fetched from that api call.

This is not a sky is falling moment we just have to be a little smarter about how we code our apps rather than relying on CCP to do the work. Given that I've seen much fewer 500/404/timout errors from CCP's API servers since this went it I'm more than happy with the trade off.
Rob Crowley
State War Academy
#12 - 2013-09-20 11:23:56 UTC  |  Edited by: Rob Crowley
xHjfx wrote:
The old one caused alot of load on the API servers
Would you happen to have a source on that (i.e. word from a dev) or is this an assumption? Cause if I were to make an assumption I'd say the new system causes more load on the API server.

Quote:
If the characterID was returned on the character list and as part of the same call you are requesting factional warfare stats - you can assume that the 400 Bad request is related to not being enrolled.
First of all, as far as I'm aware you can't technically request 2 pages on the same call, I guess you mean 2 calls in short succession. Secondly, we're all technically-minded people, so we prefer not using assumptions when we could just as well use facts. And thirdly, extra calls put extra load on the server.

Quote:
Granted it puts more onus on the coder for implementing extra logic to check the situation but I wouldn't call it guesswork either.

If it's a 403 Forbidden, then they don't have the correct access mask to request that information.
Or the key doesn't exist or the key expired or the vCode is wrong or the characterID doesn't exist or they are not enrolled in FW. Which kinda makes it ... guesswork!

You can usually eliminate some possibilites by making functionally useless extra calls just for verification purposes (though that obviously causes extra load on the server), but e.g. I believe there's no way to tell the difference between an expired key, a wrong vCode or a non-existant key.

Quote:
it isn't a showstopper either.
Shin Chogan wrote:
This is not a sky is falling moment
No strawman arguments please, nobody claimed that this is a catastrophe. Obviously 3rd party tools still use the API so the devs have adapted best as they could, but that doesn't mean the new system's error handling functionality isn't plain worse than the old one's which is something worth criticizing (and worth fixing).
Rob Crowley
State War Academy
#13 - 2013-09-20 11:37:46 UTC
Shin Chogan wrote:
I didn't like it at first but I've actually found it has simplified TEA somewhat.
How could that possibly be the case? You get just less info about errors than before, so there's literally nothing you can do now that you couldn't have done before.

Quote:
1/ get Keyinfo - 403 at this point is expired or non existant key so stop and mark bad in DB & never check again using the automatic poll
2/ check apimask is appropriate based on mask returned in xml from keyinfo - currently continue processing but in future may change this to stop processesing rules.
3/ get corpinfo, charactersheet, characterinfo, facwarstatus if any of these return a 403 then don't try and evaluate a TEA rule based on the info fetched from that api call.
That's great for you, but apart from the fact that there's still more guesswork in this than necessary (see my above post) there are usecases where you don't want to call half a character's API. If you only want to call 1 page then using a KeyInfo first for verification already doubles the server load.

Quote:
we just have to be a little smarter about how we code our apps rather than relying on CCP to do the work.
What work? The API server already knows the reason why it rejects a request, it only has to tell us. That's not work, that's server programming 101.

Like xHjfx you kinda make it sound like we are just too lazy to adapt to the new system which simply isn't the case. If we minded work we wouldn't have become unpaid 3rd party devs in the first place. We just dislike working with a system that gives us less info than it could for no good reason. If they want to keep HTTP error codes instead of XML messages that's fine by me, but then do it right and map every single error to a distinct code and document that somewhere. Sending no XML message and mapping lots of different errors to the same HTTP code was a bad idea and should get fixed.
Ydnari
Estrale Frontiers
#14 - 2013-09-20 12:12:39 UTC
xHjfx wrote:
If it's a 403 Forbidden, then they don't have the correct access mask to request that information.


Except for all the spurious 403's that the wallet and contract APIs throw randomly, when they do have access, which you can't tell apart from the ones where they don't because there's no information.

--

Shin Chogan
Federal Navy Academy
Gallente Federation
#15 - 2013-09-20 15:27:35 UTC
Rob Crowley wrote:
Shin Chogan wrote:
I didn't like it at first but I've actually found it has simplified TEA somewhat.
How could that possibly be the case? You get just less info about errors than before, so there's literally nothing you can do now that you couldn't have done before.

Quote:
1/ get Keyinfo - 403 at this point is expired or non existant key so stop and mark bad in DB & never check again using the automatic poll
2/ check apimask is appropriate based on mask returned in xml from keyinfo - currently continue processing but in future may change this to stop processesing rules.
3/ get corpinfo, charactersheet, characterinfo, facwarstatus if any of these return a 403 then don't try and evaluate a TEA rule based on the info fetched from that api call.
That's great for you, but apart from the fact that there's still more guesswork in this than necessary (see my above post) there are usecases where you don't want to call half a character's API. If you only want to call 1 page then using a KeyInfo first for verification already doubles the server load.

Quote:
we just have to be a little smarter about how we code our apps rather than relying on CCP to do the work.
What work? The API server already knows the reason why it rejects a request, it only has to tell us. That's not work, that's server programming 101.

Like xHjfx you kinda make it sound like we are just too lazy to adapt to the new system which simply isn't the case. If we minded work we wouldn't have become unpaid 3rd party devs in the first place. We just dislike working with a system that gives us less info than it could for no good reason. If they want to keep HTTP error codes instead of XML messages that's fine by me, but then do it right and map every single error to a distinct code and document that somewhere. Sending no XML message and mapping lots of different errors to the same HTTP code was a bad idea and should get fixed.


Sorry I was too rushed this morning and expressed myself poorly. As you say there are many use cases and in the case of TEA it forced me to change the approach it took which resulted in things being simpler. That said it did result in a lot of time spent rewriting which I could have spent far more productively ... ie playing the damn game :)
Cyerus
University of Caille
Gallente Federation
#16 - 2013-09-20 19:39:20 UTC  |  Edited by: Cyerus
Rob Crowley, thanks for explaining it alot better than I could.

As with Rob, I can't see why people say the new setup is alot easier. Less information, a lot more guesswork and no valid feedback we can send back to the user. If anything, it takes me a lot more time being a 3rd party dev as I have to answer email after email of people dont understanding the 403 error they are getting, as I can't get more specific as that.

Yes, most of it is solveable by doing weird jumps in the code to account for the HTTP 403's, but it shouldn't be needed. The old setup was working fine, doing exactly what it should be doing.
islador
Antigen.
#17 - 2013-10-04 18:07:41 UTC
I'm building a new app and the lack of data offered from these 403s is less then beneficial. The old error machinery was much more efficient for my purposes and I would greatly support its return.
iskflakes
#18 - 2013-10-04 22:08:35 UTC
The old system was better. I haven't updated my code to the new system yet so my app doesn't realize when it's creating errors. With the old system I had some nice backoff logic to prevent the app spamming CCP's servers with errors, however now that codepath gets skipped when the HTTP request throws an exception (and instead the app thinks there has been a network error and retries after a suitable period of time, rather than removing the key from the system).

I'll fix it eventually, maybe. Or I might just let the app die. I don't have time to fix it every time a useless cosmetic change is made to the API.

Add new API calls, don't break or change the behavior of the existing ones.

-

Swidgen
Republic University
Minmatar Republic
#19 - 2013-10-18 10:12:27 UTC
Gaius Henry wrote:
No need to repost, devs are already working on it.

Not true. They are not currently working on any of it. CCP Prism X says "I just don't have the bandwith to take a look at the API right now."

This is still a low-priority issue for CCP more than 4 months after it was identified as a big problem for 3rd-party developers. The more people squawk about it the better. And by the way, how does this square with what CCP Seagull said 9 months ago in her We Loves Us Some 3rd Party Developers devblog? Quoting the last part of paragraph 2:

CCP Seagull on 15 January 2013 wrote:
Giving third party developers better tools and more powerful access through CREST will be a big part of making life better for ”Enablers”.

How does that awesome committment of words seem to be working out for all the 3rd-party developers lately? 9 months and we've got a lot of lip service and no ******* action. God bless CCP Prism X, he realizes things aren't right and something needs to be done. But one man cannot accomplish anything when higher ups have decreed that Dust needs a bigger budget for the forseeable future. This **** pisses me off, sorry. Watch what they do, not what they say.
Ydnari
Estrale Frontiers
#20 - 2013-10-18 17:37:42 UTC
Swidgen wrote:

Not true. They are not currently working on any of it. CCP Prism X says "I just don't have the bandwith to take a look at the API right now."

What's even more galling is in the comments for the latest dev blog that they're going to spend effort to deliberately sabotage the Assets API to lie about materials being siphoned off.

--

12Next page