REST URI convention - Singular or plural name of resource while creating it

前端 未结 22 2187
长情又很酷
长情又很酷 2020-12-02 03:35

I\'m new to REST and I\'ve observed that in some RESTful services they use different resource URI for update/get/delete and Create. Such as

  • Create - using
22条回答
  •  隐瞒了意图╮
    2020-12-02 03:56

    I am surprised to see that so many people would jump on the plural noun bandwagon. When implementing singular to plural conversions, are you taking care of irregular plural nouns? Do you enjoy pain?

    See http://web2.uvcs.uvic.ca/elc/studyzone/330/grammar/irrplu.htm

    There are many types of irregular plural, but these are the most common:

    Noun type Forming the plural Example

    Ends with -fe   Change f to v then Add -s   
        knife   knives 
        life   lives 
        wife   wives
    Ends with -f    Change f to v then Add -es  
        half   halves 
        wolf   wolves
        loaf   loaves
    Ends with -o    Add -es 
        potato   potatoes
        tomato   tomatoes
        volcano   volcanoes
    Ends with -us   Change -us to -i    
        cactus   cacti
        nucleus   nuclei
        focus   foci
    Ends with -is   Change -is to -es   
        analysis   analyses
        crisis   crises
        thesis   theses
    Ends with -on   Change -on to -a    
        phenomenon   phenomena
        criterion   criteria
    ALL KINDS   Change the vowel or Change the word or Add a different ending   
         man   men
         foot   feet
         child   children
         person   people
         tooth   teeth
         mouse   mice
     Unchanging Singular and plural are the same    
         sheep deer fish (sometimes)
    

提交回复
热议问题