Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Design rules for restful URI

  • URI needs to show information of resource
    • resource should be nouns rather than verbs, lowercase letters rather than uppercase letters

      ex) GET /Members/show/1 -> GET /members/1 (verbs -> nouns, uppercase -> lowercase)

    • Server’s directory name should be plural nouns
    • Client’s storage name should be plural nouns

      ex) GET /Member/1 -> GET /members/1

  • URI should not show act on resources

    ex) GET /members/delete/1 -> DELETE /members/1
    ex) GET /members/insert/2 -> POST /members/2

  • don’t use _ in URI

    there is a possibility that you cannot see the proper information

  • File extensions are not included in the URI

    ex) http://restapi.example.com/members/soccer/345/photo.jpg (X)
    ex) GET / members/soccer/345/photo HTTP/1.1 Host: restapi.example.com Accept: image/jpg (O)

References