Error: The request was syntactically correct but its content is semantically invalid

Hi
I am getting error: The request was syntactically correct but its content is semantically invalid for below put API call. please help.

curl --location --request PUT 'https://tenant.login.sailpoint.com/v3/accounts/XXXXX' \
--header 'Content-Type: text/plain' \
--header 'Authorization: Bearer token' \
--data '{
    "attributes": {
        "displayName": "test, new name"
    }
}'

Error:

{
    "detailCode": "400.1 Bad request content",
    "trackingId": "SSSSSSSS",
    "messages": [
        {
            "locale": "und",
            "localeOrigin": "REQUEST",
            "text": "The request was syntactically correct but its content is semantically invalid."
        },
        {
            "locale": "en-US",
            "localeOrigin": "DEFAULT",
            "text": "The request was syntactically correct but its content is semantically invalid."
        }
    ],
    "causes": []
}

Hi @rakeshb ,

curl -L -X PUT 'https://sailpoint.api.identitynow.com/v2024/accounts/:id' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
--data-raw '{
  "attributes": {
    "city": "Austin",
    "displayName": "John Doe",
    "userName": "jdoe",
    "sAMAccountName": "jDoe",
    "mail": "[email protected]"
  }
}'

This was the default thing given by SailPoint.

Try using like,

curl -L -X PUT 'https://sailpoint.api.identitynow.com/v3/accounts/:id' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
--data-raw '{
  "attributes": {
    "displayName": "test, new name"
  }
}'

Hi @GOKUL_ANANTH_M
thanks for prompt response. I tried the curl you shared ( with actual tenant and account ID) but the error remains the same. I am not seeing much difference between your curl and mine. could you please highlight which specific line you trying to replace here?
P.S: I am getting valid response for same endpoint with GET operation though.

curl -L -X PUT ‘https://tenant.login.sailpoint.com/v3/accounts/11111111’
-H ‘Content-Type: application/json’
-H ‘Accept: application/json’
–header ‘Authorization: Bearer XXXXXXXX’
–data-raw ‘{
“attributes”: {
“displayName”: “test, new name”
}
}’

Error:{“detailCode”:“400.1 Bad request content”,“trackingId”:“wwwwwwww”,“messages”:[{“locale”:“und”,“localeOrigin”:“REQUEST”,“text”:“The request was syntactically correct but its content is semantically invalid.”},{“locale”:“en-US”,“localeOrigin”:“DEFAULT”,“text”:“The request was syntactically correct but its content is semantically invalid.”}],“causes”:}

Hi Rakesh,

I see some mistakes in the payload and curl execution, use the below one

curl --location --request PATCH 'https://tenant.api.identitynow-demo.com/beta/accounts/accountid' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '[
  {
    "op": "replace",
    "path": "/displayName",
    "value":"test, new name"
  }
]'

Regards,
Karthi

Hi @Karthikeyan_U
I am trying this for PUT operation not PATCH. referring API: put-account | SailPoint Developer Community

Hi Rakesh,
If you need to modify display name then given all the attribute values in the body and perform the put operation
“attributes”: {
“city”: “Austin”,
“displayName”: “test, new name”,
“userName”: “jdoe”,
“sAMAccountName”: “jDoe”,
“mail”: “[email protected]”
}
Perform get account operation and get the attributes :{ } details from it then modify the display value in it and perform the operation.
Thanks!!

Hi Rakesh,

Understood, but if you are going for PUT operation then the payload should contain all the account information not just a displayname (though you are changing the displayname alone).

My working example:

SailPoint recommends, if you are doing update on very few attributes then go for PATCH operation, if you are changing many attributes then go for PUT operation.

Thanks,
Karthi

2 Likes

Thanks. I tried putting all the attributes that i am getting from GET operation for the user but still it failed with same error. I am wondering if its because of below note:
Note: You can only use this PUT endpoint to update accounts from flat file sources.

my source is not flat file but connected system. So i guess that could be the reason.

That is most likely the reason. I don’t think the PATCH operation has that limitation, so you should be able to use it to update accounts on connected sources. However, be aware that any changes you make to accounts via this API will be overwritten the next time the source is aggregated.

@rakeshb,

As per my experience when you get this error it means, your API is correct but what you are trying to do is not allowed. So, most probably you can not update accounts coming from connected source.

Thanks.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.