SAP Knowledge Base Article - Public

2658508 - Error: Illegal JSON string-value format while executing an Upsert call on ODATA Entity

Symptom

Below error comes while executing an Upsert Call on an ODATA Entity:

<d:message>Illegal JSON string-value format</d:message>

Environment

SuccessFactors

Reproducing the Issue

1. Send an Upsert API Call (For example: Upsert API Call for ODATA API Entity Background_Education)

    POST https://apisalesdemo4.successfactors.com/odata/v2/upsert

    Request Body:

    [
            {
                "__metadata": {
                    "uri": "https://apisalesdemo4.successfactors.com:443/odata/v2/Background_Education(backgroundElementId=100L,userId='pjuvan1')",
                    "type": "SFOData.Background_Education"
                },
                "backgroundElementId": "100",
                "userId": "pjuvan1",
                "startDate": null,
                "bgOrderPos": "1",
                "school": "true",
                "degree": 216,
                "StillAttending": null,
                "endDate": null,
                "major": "99"
    
           }
    ]

2. The response has the below error:

    <d:status>ERROR</d:status>
    <d:editStatus>UPSERTED</d:editStatus>
    <d:message>Illegal JSON string-value format</d:message>

Cause

The format of the request body is not correct

Resolution

1. All the input values needs to be passed in double quotes (" ")

2. Re-run the Upsert API Call (For example: In the above erroneous payload the value for the field degree ie 216 was not passed in double quotes, correct the request payload by passing the input value in double quotes and re-run the upsert API call for the sample ODATA entity: Background_Education)

    POST https://apisalesdemo4.successfactors.com/odata/v2/upsert

    Request Body:

    [
            {
                "__metadata": {
                    "uri": "https://apisalesdemo4.successfactors.com:443/odata/v2/Background_Education(backgroundElementId=100L,userId='pjuvan1')",
                    "type": "SFOData.Background_Education"
                },
                "backgroundElementId": "100",
                "userId": "pjuvan1",
                "startDate": null,
                "bgOrderPos": "1",
                "school": "true",
                "degree": "216",
                "StillAttending": null,
                "endDate": null,
                "major": "99"
    
           }
    ]

3. The upsert call will be successful and the data would be upserted in the system. Response will be like below:

   <d:status>OK</d:status>

Keywords

Illegal JSON string-value format, Upsert , KBA , LOD-SF-INT-ODATA , OData API Framework , LOD-SF-INT , Integrations , Problem

Product

SAP SuccessFactors HCM Core 1805