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.

request payload type

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.

Current Request Info

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.

IP Check

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.

HTTP Request

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.

BP Complete

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.

Was this article helpful?

AppMaster.io 101 Crash Course

10 modules
2 weeks

Not sure where to start? Get going with our crash course for beginners and explore AppMaster from A to Z.

Start Course
Development it’s so easy with AppMaster!

Need More Help?

Solve any issue with the help of our experts. Save time and focus on building your applications.


Contact Support

Tell us about your problem, and we’ll find you a solution.


Community Chat

Discuss questions with other users in our chat.

Join Community