SAP Knowledge Base Article - Public

3741001 - Error "Key property (User/userId) is not specified" when upserting User entity - OData API

Symptom

You would like to create or update users, and upsert User entity with OData API.

You provide all the required fields in the payload, but get the error "Key property (User/userId) is not specified".

Environment

SAP SuccessFactors HCM

  • OData API

Reproducing the Issue

Upsert the User entity with a request payload like below:

{
  "__metadata": {
    "uri": "User",
    "type": "SFOData.User"
  },
  "userId": "acraig",
  "username": "acraig",
  "status": "t",
  "gender": "F",
  "firstName": "Amy",
  "lastName": "Craig"
}

Then the error happens, though the field "userId" is already provided in the payload.

Cause

The User ID is not specified in the URI metadata of the payload.

Resolution

Provide the User ID in the URI metadata of the payload.

Sample Payload:

{
  "__metadata": {
    "uri": "User('acraig') ",
    "type": "SFOData.User"
  },
  "userId": "acraig",
  "username": "acraig",
  "status": "t",
  "gender": "F",
  "firstName": "Amy",
  "lastName": "Craig"
}

Keywords

Employee Central, metadata uri, api write error, post, missing key, create user, user payload , KBA , LOD-SF-INT-ODATA , OData API Framework , Problem

Product

SAP SuccessFactors HCM Core all versions