SAP BTP Small Talk: Checking the Payload in an API Request
Introduction
Let's say you have an API that needs to be triggered by a third party. As a BTP developer, you need to validate that the request payload is present before processing the request. How can this be implemented?
Using the Raise Fault API Policy
You can enforce this validation in SAP API Management using the Raise Fault policy within the PreFlow of the API Proxy. To trigger an error when no payload is provided, apply the following condition expression:
See Raise Fault
See Condition Strings
See Java Script Object Model

The Raise Fault policy allows you to specify:
- The HTTP response code (e.g., 400 Bad Request)
- A custom error message
- The response payload that will be sent to the client
Testing
In the video snippet below, you can see the API being called without a payload (causing an error) and with a valid payload (processing successfully).