SAP Knowledge Base Article - Public

2944407 - Error Message While Trying to Create an Employee Through OData Call

Symptom

You are receiving the error message below while trying to use a POST OData call to create an Employee in the EmployeeCollection.

400 Bad Request - The server could not understand the request due to malformed syntax.

Environment

SAP Cloud for Customer 2002 and higher.

Reproducing the Issue

  1. Go to the REST API Software (e.g Postman).
  2. Insert your credentials.
  3. Generate the CSRF Token.
  4. Use the payload below in the JSON-body.

{

"UserID":"Testing_Employee",
"EmployeeID":"12345",
"EmployeeValidityStartDate":"2020-02-20T15:49:48",
"EmployeeValidityEndDate":"9999-12-31T00:00:00",
"FirstName":"Testing",
"LastName":"Employee",
"UserValidityStartDate":"2020-02-20T15:49:48",
"UserValidityEndDate":"9999-12-31T00:00:00",
"UserPasswordPolicyCode":"S_BUSINESS_USER",
"CountryCode":"US",
"Email":"testing.employee@test.com",
"UserLockedIndicator":"false"
}

Cause

The error is occurring due to the quotation marks at the value for the "UserLockedIndicator". For Boolean values we don't use the quotation marks.

Resolution

You need to remove the quotation marks from the "UserLockedIndicator" attribute. Kindly use the payload as follows:

{

"UserID":"Testing_Employee",
"EmployeeID":"12345",
"EmployeeValidityStartDate":"2020-02-20T15:49:48",
"EmployeeValidityEndDate":"9999-12-31T00:00:00",
"FirstName":"Testing",
"LastName":"Employee",
"UserValidityStartDate":"2020-02-20T15:49:48",
"UserValidityEndDate":"9999-12-31T00:00:00",
"UserPasswordPolicyCode":"S_BUSINESS_USER",
"CountryCode":"US",
"Email":"testing.employee@test.com",
"UserLockedIndicator":false
}

Keywords

OData, Create, POST, EmployeeCollection, Error, 400 Bad Request. , KBA , AP-RC-ODF , OData framework (C4C Only) , How To

Product

SAP Cloud for Customer add-ins all versions ; SAP Cloud for Customer core applications all versions