Skip to content
TORNLIFE More

Key API: response error schema

Started by DeepState [2543958] on in Bugs & Issues.

7 replies · 120 views · thread synced · 4 days ago · View on torn.com
About this thread

Posts archived: 8 / 8 posts (100%) · the total is Torn's reply count + the opening post at the last fetch

Counted by TornLife from the archived posts.

Archived posts
8
Discussion span
→
People posting
6
Likes on archived posts
4
Posts by staff, officers and moderators
3
Authority score
59 / 100
Historical score
32 / 100
Story score
38 / 100
Engagement score
49 / 100

Most-liked replies

DeepState [2543958]
Hi Torn Developers,

Very minor issue with the Key API, when the following is submitted:
GET https://api.torn.com/key/?key={valid_key}
the Key API Returns:
{"code":1,"warning":"No default selection for this type"}
Expected Response should be something like?:
{"error":{"code":4,"error":"Requesting incorrect selection fields"}}

Apologies if I'm wrong on my understanding. This also occurs with the Torn API under similar circumstances.

Cheers!
Acarya [2243227]
Try https://api.torn.com/key/?selections=infoo&key=xyz and you will get
{"error":{"code":4,"error":"Wrong fields"}}


But the warning message without any selections param is pretty clear. Since you did not explicitly request any fields an error message to the contrary will just confuse people.
CloudJumper [1636201]Staff
I think the warning message is correct in this context. I will refer this to Joe for verifying.

Thanks!
DeepState [2543958]
Hi Both,
Apologies, let me clarify, its not that I think the message is wrong per se, but that this warning is not in the same schema as other errors/warnings associated with the Torn API.

Perhaps the below is more illustrative of what I mean. This is how I feel the warning should look?
{"warning":{"code":1,"warning":"No default selection for this type"}}
Chedburn [1] Admin Developer
I see both errors are formatted differently, but I'm not sure why. I don't know why one is framed as an 'error', and the other a 'warning'. I'm pretty sure they could all be filed under 'error'. I'll ask Pavel for his advice.

{"error":{"code":4,"error":"Wrong fields"}}
{"warning":{"code":1,"warning":"No default selection for this type"}}