When creating an endpoint for a business process, you must specify the type of data that will be sent in this request (Request payload type). The most common option is JSON; it allows you to conveniently specify all the necessary parameters and pass a data model or an array of objects. In addition, other options are possible, for example, XML or Multipart Form (if you need to send files).
At the same time, a situation is acceptable when the exact structure is not known in advance (or it simply does not matter). In this case, a reasonable option is to use "raw" queries.
Business Process for raw requests
Imagine a situation where this might be needed. Let's say that the service we are developing is just a connecting link. Its task is to receive a request from the user, check authorization, save logs, perform spam protection, and redirect the request further if everything is in order.
An important feature of Raw queries is that no input parameters are used when designing business processes. Instead, a special block is used to get the request body - Get Request Body. Suppose you are interested in extended information about the request. In that case, the Current Request Info block is a suitable option - it returns not only the request body but also additional parameters and request headers.
In the case when we are interested in a specific header from the request, it can be obtained using the Get Request Header block. The example above reads the X-Real-IP header, which contains the IP address of the request. The resulting IP is passed to a function that must check that the given IP is valid and not on the blacklist of banned addresses. As a result, the process will either be aborted with an appropriate error message or, if everything is in order, further execution will be allowed.
The request, received as Raw, is represented as an array of bytes. For the convenience of perception, it can be converted to a string (To String block); in this form, information is stored in the logs.
In this case, the request itself, without any transformations, can be redirected further using the HTTP Request block. In this example, the request method, its URL, and the request body (obtained from the Current Request Info block) are specified. The result of the HTTP Request block is used as the result of the entire business process.
The screenshot shows the final business process. Please note that the function blocks (FUNC Save request Log and FUNC IP Blacklist Check) are examples and exist only within this project's scope.
Thus, the endpoint can be used to work with any request, regardless of its actual content. You do not need to know the exact request that should be sent to a third-party service, and even if there are some changes in it (adding a model, renaming parameters), you can continue to use the endpoint without making changes to the project.