Just to clarify we are only changing the HTTP status codes and response
message formats (of error and successful messages) in the REST API. We are
not changing any of the API method definitions or JSON definitions.

Dinithi: It would be great if you could list of out the changes in point
form.

Thanks

On Wed, Apr 22, 2015 at 11:26 AM, Anuruddha Liyanarachchi <
anurudd...@wso2.com> wrote:

> Hi,
>
> Please find the list of current status codes that are being used [1].
>
> [1]
> https://docs.google.com/spreadsheets/d/1orFbcvkrowtz_LKJL7IXzQgBBxloMkFICobZGxlKMuA/edit?usp=sharing
>
> On Wed, Apr 22, 2015 at 11:15 AM, Dinithi De Silva <dinit...@wso2.com>
> wrote:
>
>> 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
>>
>
>
>
> --
> *Thanks and Regards,*
> Anuruddha Lanka Liyanarachchi
> Software Engineer - WSO2
> Mobile : +94 (0) 712762611
> Tel      : +94 112 145 345
> a <thili...@wso2.com>nurudd...@wso2.com
>



-- 
Imesh Gunaratne

Technical Lead, WSO2
Committer & PMC Member, Apache Stratos

Reply via email to