Hands-On RESTful API Design Patterns and Best Practices
上QQ阅读APP看书,第一时间看更新

Learning about Uniform Resource Identifiers

REST APIs should use Uniform Resource Identifiers (URIs) to represent their resources. The resource indications should be clear and straightforward so that they communicate the APIs resources crisp and clearly:

  • A sample of a simple to understand URI is https://xx.yy.zz/sevenwonders/tajmahal/india/agra, as you may observe that the emphasized texts clearly indicates the intention or representation
  • A harder to understand URI is https://xx.yy.zz/books/36048/9780385490627; in this sample, the text after books is very hard for anyone to understand

So having simple, understandable representation in the URI is critical in RESTful API design.

The following section deals with many such URI aspects for RESTful services.