Hi Sominda, I think it is better to start all the client errors with 400 (Ex USR-400xx) and server errors with 500 (Ex USR-500xx). In this way, we can get some understanding of the error by looking at the error code.
Cheers, Isura. On Thu, Aug 29, 2019 at 2:44 PM Sominda Gamage <somi...@wso2.com> wrote: > Hi all, > > Currently, the REST APIs of Identity Server have different error codes > such as (20018, 20048, etc.). The error codes in this format have less > information regarding the cause or where it has occurred. > > Therefore, we would like to maintain the error codes which are used in our > REST APIs in one commonplace. Currently, we are standardizing error codes > along with their details and this is still a work in progress. > > According to this effort, sample error code will look like “ > <Prefix>-<error-identifier-number> > > Eg: CQM-10005 > > The Prefix (first part) indicates the component. In this case, CQM > indicates Challenge Questions Management. > The error-identifier-number (the second part of the error code) reflects > the numerical identifier for the error. > > For the rest APIs, we have defined 2 types of codes for both user and > server APIs. > > - > > Success codes: For successful operations > - > > Error codes: For error scenarios > - > > Client Errors > - > > Server Errors > > > > *Success Codes* > > Despite the API type, all the success codes will start from 02000 onwards. > To maintain consistency, a zero will be added at the beginning. > > Eg: USR-02001 > > The above Success Code indicates a successful User Self Registration. > > > *Error Codes* > > With the introduction of API error standards, we wish to standardize the > error response from an API. Therefore, a sample API error response will be > as follows. > > { > > “code” : “some_error_code”, > > “Message” : “some_error_message”, > > “Description” : “some_error_description”, > > “traceID” : “correlation_id” > > } > > A correlationId has been introduced to log the error and send with the > response > > > *User API errors* > > User APIs has two types of errors. > > 1. > > Client errors > 2. > > Server errors > > *Client Errors in user APIs* > > For client errors in user APIs, we have allocated the range starting from > 100. > > Eg: USR-100xx > > *Server Errors in user APIs* > > For server errors in user APIs, we have allocated the range starting from > 100. > > Eg: USR-150xx > > > *Server API Errors* > > Server APIs has two types of errors. > > 1. > > Client errors > 2. > > Server errors > > *Client errors in server APIs* > > For client errors in server APIs, we have allocated the range starting > from 500. > > Eg: USR-500xx > > *Server Errors in server APIs* > > For server errors in server APIs, we have allocated the range starting > from 550. > > Eg: USR-550xx > > > This will be the new standardization for Rest API Success and Error > responses. > > > Thanks & Regards, > > Sominda. > > -- > *Sominda Gamage* | Software Engineer| WSO2 Inc. <http://wso2.com/> > (M)+94 719873902 | (E) somi...@wso2.com > <https://wso2.com/signature> > _______________________________________________ > Architecture mailing list > Architecture@wso2.org > https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture > -- *Isura Dilhara Karunaratne* Technical Lead | WSO2 <http://wso2.com/> *lean.enterprise.middleware* Email: is...@wso2.com Mob : +94 772 254 810 Blog : https://medium.com/@isurakarunaratne
_______________________________________________ Architecture mailing list Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture