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) [email protected]
<https://wso2.com/signature>
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to