Example 7-5 Pagination: No Parameters Yields the
Default
Click here to view code image
# returns the devices 0 to 200
Note that the data returned by the service usually has
links to the next and the previous pages, as shown in
Example 7-6.
Example 7-6 Pagination Response Containing Links
Click here to view code image
GET /devices?offset=100&limit=10
{
"pagination": {
"offset": 100,
"limit": 10,
"total": 220,
},
"device": [
//...
],
"links": {
"next": "http://myhouse.cisco.com/devices?
offset=110&limit=10",
"prev": "http://myhouse.cisco.com/devices?
offset=90&limit=10"
}
}
Rate Limiting and Monetization
Rate limiting is an essential REST API design method for
developers. Rate-limiting techniques are used to increase
security, business impact, and efficiency across the board
or end to end. Let’s look at how rate limiting helps with
each of them:
Security: Allowing unlimited access to your API is essentially like
handing over the master key to a house and all the rooms therein.
While it’s great when people want to use your API and find it useful,
open access can decrease value and limit business success. Rate