-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Api response statuses #19
Comments
If we haven't setup custom error codes for something yet, it uses the HTTP response code as the status. Unfortunately that means for now you'll have to parse the message anytime the status isn't 1 in order to figure out what went wrong. |
@rannmann by parse you mean.... what? Is there a list of these possible edit for further elaboration to not sound like I'm salt mining: The biggest worry I have here is, this whole ExpressTrades thing can easily become another Steam, but instead of Gaben (praise the lord), we're trying to get along with Opskins and figure out what the flavor of the month peculiarity will be. This is not meant to be criticism against ExpressTrades or Opskins for that matter. It's just a difference between do you wan't to create a service that primarily serves opskins interests and the rest of us are free to use it, but it comes with it's opskins maintenance tuesdays and "parse the message mate" types of caveats. I personally don't mind either way but if I had the opportunity to choose, I would prefer you create a thing that is meant to be consumed by 3rd parties instead of a thing that can be consumed by 3rd parties. |
I think it would be helpful to update the API endpoints with possible Here are the status codes used, almost all should match an OPSkins Error Code, which have descriptions here. 1xx user account errors I will add this to the documentation as well when I get a chance. JS Object: const ErrorCodes = {
OK: 1,
GENERIC_USER_ACCOUNT_ERROR: 102,
ACCESS_DENIED: 106,
NOT_LOGGED_IN: 108,
NEEDS_TWOFACTOR: 112,
TWOFACTOR_INCORRECT: 122,
USERNAME_TAKEN: 124,
UNACCEPTABLE_USERNAME: 126,
GENERIC_INTERNAL_ERROR: 202,
DATABASE_ERROR: 204,
NOT_FOUND: 206,
BAD_STATE: 208,
NO_MATCHING_ITEMS_FOUND: 210,
CANNOT_CREATE_DIRECTORY: 216,
FILE_UPLOAD_ERROR: 218,
FILE_UPLOAD_ALREADY_EXISTS: 220,
CANNOT_DELETE_FILE: 222,
ALREADY_IN_THAT_STATE: 226,
LOCKED: 228,
DISABLED: 234,
MALFORMED_RESPONSE: 236,
EXPIRED: 238,
EMPTY_DATA: 240,
ITEM_NEEDS_REPAIR: 246,
ITEM_NOT_IN_INVENTORY: 248,
BAD_INPUT: 302,
UNACCEPTABLE_ITEM: 304,
DUPLICATE_ITEM: 306,
BAD_REQUEST: 312,
CAPTCHA_INVALID: 316,
RATE_LIMIT_EXCEEDED: 318,
MISSING_DEPENDENCY: 326,
REQUEST_OR_FILE_TOO_LARGE: 330,
UNACCEPTABLE_FILE_TYPE: 332,
THIRD_PARTY_UNAVAILABLE: 408
} PHP Array $errorCodes = [
"OK" => 1,
"GENERIC_USER_ACCOUNT_ERROR" => 102,
"ACCESS_DENIED" => 106,
"NOT_LOGGED_IN" => 108,
"NEEDS_TWOFACTOR" => 112,
"TWOFACTOR_INCORRECT" => 122,
"USERNAME_TAKEN" => 124,
"UNACCEPTABLE_USERNAME" => 126,
"GENERIC_INTERNAL_ERROR" => 202,
"DATABASE_ERROR" => 204,
"NOT_FOUND" => 206,
"BAD_STATE" => 208,
"NO_MATCHING_ITEMS_FOUND" => 210,
"CANNOT_CREATE_DIRECTORY" => 216,
"FILE_UPLOAD_ERROR" => 218,
"FILE_UPLOAD_ALREADY_EXISTS" => 220,
"CANNOT_DELETE_FILE" => 222,
"ALREADY_IN_THAT_STATE" => 226,
"LOCKED" => 228,
"DISABLED" => 234,
"MALFORMED_RESPONSE" => 236,
"EXPIRED" => 238,
"EMPTY_DATA" => 240,
"ITEM_NEEDS_REPAIR" => 246,
"ITEM_NOT_IN_INVENTORY" => 248,
"BAD_INPUT" => 302,
"UNACCEPTABLE_ITEM" => 304,
"DUPLICATE_ITEM" => 306,
"BAD_REQUEST" => 312,
"CAPTCHA_INVALID" => 316,
"RATE_LIMIT_EXCEEDED" => 318,
"MISSING_DEPENDENCY" => 326,
"REQUEST_OR_FILE_TOO_LARGE" => 330,
"UNACCEPTABLE_FILE_TYPE" => 332,
"THIRD_PARTY_UNAVAILABLE" => 408
]; PHP consts: const OK = 1; // no error
// 1xx = user account error
const GENERIC_USER_ACCOUNT_ERROR = 102;
const ACCESS_DENIED = 106;
const NOT_LOGGED_IN = 108;
const NEEDS_TWOFACTOR = 112;
const TWOFACTOR_INCORRECT = 122;
const USERNAME_TAKEN = 124;
const UNACCEPTABLE_USERNAME = 126;
// 2xx = internal error
const GENERIC_INTERNAL_ERROR = 202;
const DATABASE_ERROR = 204;
const NOT_FOUND = 206;
const BAD_STATE = 208;
const NO_MATCHING_ITEMS_FOUND = 210;
const CANNOT_CREATE_DIRECTORY = 216;
const FILE_UPLOAD_ERROR = 218;
const FILE_UPLOAD_ALREADY_EXISTS = 220;
const CANNOT_DELETE_FILE = 222;
const ALREADY_IN_THAT_STATE = 226;
const LOCKED = 228;
const DISABLED = 234;
const MALFORMED_RESPONSE = 236;
const EXPIRED = 238;
const EMPTY_DATA = 240;
const ITEM_NEEDS_REPAIR = 246;
const ITEM_NOT_IN_INVENTORY = 248;
// 3xx = user error
const BAD_INPUT = 302;
const UNACCEPTABLE_ITEM = 304;
const DUPLICATE_ITEM = 306;
const BAD_REQUEST = 312;
const CAPTCHA_INVALID = 316;
const RATE_LIMIT_EXCEEDED = 318;
const MISSING_DEPENDENCY = 326;
const REQUEST_OR_FILE_TOO_LARGE = 330;
const UNACCEPTABLE_FILE_TYPE = 332;
// 4xx = Third party error
const THIRD_PARTY_UNAVAILABLE = 408; |
Added an internal ticket to go back and fix all the instances where HTTP status codes are the error code in the API response. |
Error codes have been updated for API endpoints so they no longer show the HTTP Status code as the error code. |
Hi,
Is there a list of status responses? For the status field below?
{ "status": 1, "time": 1528334546, "response": { "offer": { "some_data": "here" } } }
I'm looking for a more normal way to detect that an item was already used in trade. Currently I receive such response:
{ "status": 400, "time": 1530010378, "message": "There is an offer #XXXXXX with the same parameters." }
Is status of 400 directly related with this case that item is already used? or does it mean something entirely different.
Can you point me in the right direction?
The text was updated successfully, but these errors were encountered: