Show TOC

How to Handle Bad Request ErrorsLocate this document in the navigation structure

Use

Symptom

Solution

I get a Bad Request error message when I try to post a new resource or try to update a resource.

Set the HTTP header name X-Requested-With and value XMLHttpRequest.

I get a Bad Request when I try to post data in a function import in my request body.

OData function imports are only parameterized via URL parameters. No request body is allowed.

The custom header is needed for security reasons. It provides CSRF (Cross Script Request Forgery) protection for the SAP Gateway services. Any change state request (POST, PUT. DELETE) requires that header. If not sent the request is rejected by the SAP Gateway OData runtime.