Typically, you do this by accepting the request, storing it in your database, sending a response and then process the request. You can use the ProcessQueue module to processing the request later. I would recommend this option, because you can handle concurrent requests and each request is executed in its own transaction.
Alternatively, as the most basic solution, you could have a ScheduledEvent running which checks in the database if there are any new requests present.
If you’re using Mendix 7+, have a look at the REST microflow actions.
These will allow you to get a HTTP reponse from your API, query that response and then perform whatever logic you require.
You can do this in 7 too.