You are browsing the documentation for version 4.2 of OroCommerce, OroCRM and OroPlatform, which is no longer maintained. Read version 5.1 (the latest LTS version) of the Oro documentation to get up-to-date information.

See our Release Process documentation for more information on the currently supported and upcoming releases.

Request Type

A request type is a crucial concept of the ApiBundle.

A set of processors handles each API request, and each processor pulls its weight to reach the requested result. Some processors analyze and validate the request data, while others update the database and prepare the correct response. If you need to process different types of API requests, e.g., REST API and REST API that conforms the JSON:API specification, you need to have a different set of processors. Some of them may work for all request types, and others only for specific ones. The concept of the request type in ApiBundle reflects all mentioned above and enables you to configure shared and specific processors easily.

Take a look at the RequestType class. It was designed to contain different aspects of a request; the combination of these aspects represents a specific request type. For instance, if this class contains both rest and json_api, it can be interpreted as a request type for REST API that conforms the JSON:API specification. If you add the my_erp aspect to this request type, this means that such request type represents REST API specially designed for the integration with “My ERP” system and it is based on the JSON:API specifications. If, for example, you have two types of REST API, one that conforms the JSON:API specification and another one that conforms the GraphQL specification, then the RequestType object may contain rest and json_api for JSON:API requests and rest and graphql for GraphQL requests.

Such combinations of aspects enable you to configure different sets of processors for each request type. See examples of configuring processors for different aspects and their combinations in the Processor Conditions topic.