Request parameters are available through the ”params” hash object.
Parameters are automatically populated from the request body on POST and PUT for form input, JSON and XML content-types.
Grape allows you to access only the parameters that have been declared by your ’params’ block. It filters out the params that have been passed, but are not
We can define requirements for your named route parameters using regular expressions on namespace or endpoint.
We can abort the execution of an API method by raising errors with
We can also return JSON formatted objects by raising error! and passing a hash instead of a message.
Grape can be told to rescue all exceptions and return them in the API format.
You can also rescue specific exceptions.
If we do not specify any, Grape will support XML, JSON, BINARY, and TXT content-types. The default format is :txt
1. Designed to run on rack or existing application frameworks such as Rails and Sinatra
2. It has built-in support for common conventions, including multiple formats, subdomain/prefix
3. Versioning is very easy.
4. A lightweight framework which is loosely coupled with other application frameworks.