Force.com REST API is a powerful but generic way to access data. For some application-specific data access scenarios, such as those involving transactions that span multiple database objects, a custom API is helpful. You can expose your Apex classes as REST services, making simple atomic units of work accessible to callers outside of Force.com, and hiding the implementation details from them. Requests to custom Apex REST services are made via HTTP in JSON or XML format, dictated by the
Content-Type header, with JSON the default.
For an Apex class to become a REST Web service, it must follow different rules than ordinary Apex classes. The most significant rules are listed here:
Global class access modifier— ...