Richardson maturity model

 Richardson maturity model :

     Measure the level of your REST services :


Level 0 :  Expose SOAP web services to RESTful style

                    this stage : Improper use of HTTP methods

SOAP endpoints

                eg : http://server/getPosts

                     http://server/deletePosts

    

Level 1: Expose Resources with proper URI but this level REST has improper use of HTTP methods.

            REST endpoints:   

       http://server/accounts

      http://server/accounts/1


Level 2: LEVEL 1 + HTTP METHODS 

LEVEL 3 :  LEVEL 2 + HATEOAS + NEXT POSSIBLE ACTIONS ON THE RESOUCES


 BEST practices :

   1. CONSUMER FIRST

            -->DOCUMENTATION

 

  2. BEST USE OF PROPER HTTP METHODS

3. SPECIFIC RESPONSE STATUS

            200 -SUCCESS

             404 -RESOUCE NOT FOUND

             400- BAD REQUEST

            201 -CREATED

             401 -UNAUTHORIZED

             403 -FORBIDDEN

              500 -INTERNAL SERVER ERROR



 4  --> No secure or sensitive info in the URI or response

 5 ALWASY USE PLURALS IN URIS

Prefer

            /users/

           /users/1

--> Use NOUN for resouces 

--> Use consistent approach if you con't use NOUNS in uris.

    eg : users/search   --> action on the resource

GIThub uses like below

        PUT -- gists/{id}/star

        delete - gists/{id}/star

        



    

Comments

Popular posts from this blog

REST Spring coding