Hi all,

We are in the process of re-factoring the REST API with the following
changes (As discussed in a separate mail thread - [Discuss] REST API
Improvements ).

1. *Moving non-API methods to StratosApiV41Utils class from **StratosApiV41
class*. (Refer the mail thread - API methods for tenants)

2. *Re-factoring the response message according to the below structure.*
(Refer the mail thread - [Question] Is is correct for two different status
codes appear when adding a tenant?)

Currently we are using two bean classes for success response and error
response. After this modification there will be only one unified response
bean.

{
   "status":"successful",
   "message":"Application A1 created successfully"
}

{
   "status":"error",
   "message":"An application with the id A1 already exists"
}

3. *Using a small range of status codes to improve the user experience
and also resolving issues in status codes.* (Refer the mail thread -  [Discuss]
REST API Improvements)

So the 209 - No Content status code will be removed and the following will
be used.

   - *200 OK* - GET, DELETE (with content body), PUT - Success
   - *201 Created* - POST - Resource Created, send Location header
   - *202 Accepted* - Used in application deployment and undeployment
   - *404 Not Found* - GET, POST, PUT, DELETE
   - *409 Conflict* - POST, PUT - Resource being added already exists
   - *400 Bad Request* - Other request error (only)
   - *500 Internal Server Error* - Error is server side


4.* Resolving problems in exception throwing and validating requests. *(Refer
the mail thread -  [Discuss] REST API Improvements)

Currently when a server side exception is caught, it always throws a
RestAPIExceptions.
This should be modified to throw custom exceptions when needed.

Also the CLI and the UI will be changed according to these modifications.

Please feel free to add your comments if I am missing something here.

-- 
*Dinithi De Silva*
Associate Software Engineer, WSO2 Inc.
m:+94716667655 | e:dinit...@wso2.com | w: www.wso2.com
| a: #20, Palm Grove, Colombo 03

Reply via email to