Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

PATCH call for update account not working

parthaghosh
Regular Contributor
Regular Contributor

Dear Experts,

In my REST connector, the SCIM PATCH call for update account is not working.
Same call in postman with same payload is working.

UpdateAccountJSON--------------------------------------------

{
"call": [
{
"name": "call1",
"connection": "acctAuth",
"url": "https://xxxxxxxxxxxxxxxxxxxxxxxxxxxx/v2/Users/${account.accountID}",
"httpMethod": "PATCH",
"httpParams": "{\"schemas\": [\"urn:ietf:params:scim:api:messages:2.0:PatchOp\"],\"Operations\": [{\"op\": \"replace\",\"path\": \"urn:ietf:params:scim:schemas:core:2.0:User:name.givenName\",\"value\": \"${user.firstname}\"},{\"op\": \"replace\",\"path\": \"urn:ietf:params:scim:schemas:core:2.0:User:name.familyName\",\"value\": \"${user.lastname}\"},{\"op\": \"replace\",\"path\": \"emails\",\"value\": [{\"value\": \"${user.email}\"}]}]}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"successResponses": {
"statusCode": [
200
]
}
}
]
}

-------------------------------------------------------------------------------------

postman:

parthaghosh_0-1726571689867.png

-----------------------------------------------------

error coming in task :

{
"auditDetails": {
"call1": [
{
"headers": null,
"message": {
"status": "error",
"message": "Error while parsing data.(SyntaxError: Unexpected token 'u', \"[urn:ietf:p\"... is not valid JSON)"
},
"statusCode": 400,
"description": null,
"status": "Failed"
}
]
},
"call1": {
"headers": null,
"message": {
"status": "error",
"message": "Error while parsing data.(SyntaxError: Unexpected token 'u', \"[urn:ietf:p\"... is not valid JSON)"
},
"statusCode": 400,
"description": null,
"status": "Failed"
}
}

Will appreciate any help.

thanks in advance

Partha

17 REPLIES 17

rushikeshvartak
All-Star
All-Star

Please share full logs in text format


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

here is the log

{
  "call": [
    {
      "name": "call1",
      "connection": "acctAuth",
      "url": "https://xxxxxxxxxxxxxxxxxxxxxxxxxxxx/v2/Users/${account.accountID}",
      "httpMethod": "PATCH",
      "httpParams": "{\"schemas\": [\"urn:ietf:params:scim:api:messages:2.0:PatchOp\"],\"Operations\": [{\"op\": \"replace\",\"path\": \"urn:ietf:params:scim:schemas:core:2.0:User:name.givenName\",\"value\": \"${user.firstname}\"},{\"op\": \"replace\",\"path\": \"urn:ietf:params:scim:schemas:core:2.0:User:name.familyName\",\"value\": \"${user.lastname}\"},{\"op\": \"replace\",\"path\": \"emails\",\"value\": [{\"value\": \"${user.email}\"}]}]}",
      "httpHeaders": {
        "Authorization": "${access_token}",
        "Content-Type": "application/json"
      },
      "successResponses": {
        "statusCode": [200]
      }
    }
  ]
}

Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

No luck Rushi,

parthaghosh_0-1726644988932.png

 

Share postman body as text and also try with hardcoded value once to narrow down issue


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Here is the postman body: Working

{
    "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:PatchOp"
    ],
    "Operations": [
        {
            "op": "replace",
            "path": "urn:ietf:params:scim:schemas:core:2.0:User:name.givenName",
            "value": "Arbnore-updated"
        },
        {
            "op": "replace",
            "path": "urn:ietf:params:scim:schemas:core:2.0:User:name.familyName",
            "value": "Areia Castro updated"
        },
        {
            "op": "replace",
            "path": "emails",
            "value": [
                {
                    "value": "testg.updated1@mgc.vh"
                }
            ]
        },
        {
            "op": "replace",
            "path": "urn:ietf:params:scim:schemas:core:2.0:User:active",
            "value": true
        }
    ]
}
 
Hardcoded UpdateAccountJSON

{
"call": [
{
"name": "call1",
"connection": "acctAuth",
"url": "https://xxxxxxxxxxxxxxxxxxxxxxxxxx/scim/v2/Users/14",
"httpMethod": "PATCH",
"httpParams": "{\"schemas\": [\"urn:ietf:params:scim:api:messages:2.0:PatchOp\"],\"Operations\": [{\"op\": \"replace\",\"path\": \"urn:ietf:params:scim:schemas:core:2.0:User:name.givenName\",\"value\": \"${user.firstname}\"},{\"op\": \"replace\",\"path\": \"urn:ietf:params:scim:schemas:core:2.0:User:name.familyName\",\"value\": \"${user.lastname}\"},{\"op\": \"replace\",\"path\": \"emails\",\"value\": [{\"value\": \"${user.email}\"}]}]}",
"httpHeaders": {
"Authorization": "${access_token}",
"Content-Type": "application/scim+json"
},
"successResponses": {
"statusCode": [200]
}
}
]
}
 
Its giving below error

"call1": {
"headers": null,
"message": {
"status": "error",
"message": "An unexpected error occurred -2- please contact support for assistance."
},
"statusCode": 500,
"description": null,
"status": "Failed"
}

Check with app team when above error occurs


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

But surprisingly postman call works fine with response 200
here is the postman req and response

curl --location --request PATCH 'https://xxxxxxxxxxxxxxxxxxx/scim/v2/Users/14' \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \

--data-raw '{

    "schemas": [

        "urn:ietf:params:scim:api:messages:2.0:PatchOp"

    ],

    "Operations": [

        {

            "op": "replace",

            "path": "urn:ietf:params:scim:schemas:core:2.0:User:name.givenName",

            "value": "Arbnore-updated"

        },

        {

            "op": "replace",

            "path": "urn:ietf:params:scim:schemas:core:2.0:User:name.familyName",

            "value": "Areia Castro updated"

        },

        {

            "op": "replace",

            "path": "emails",

            "value": [

                {

                    "value": testg.updated1@mgc.vh

                }

            ]

        }

    ]

}'

{

    "schemas": [

        "urn:ietf:params:scim:schemas:core:2.0:User"

    ],

    "id": 14,

    "userName": "M9004422",

    "name": {

        "givenName": "Arbnore-updated",

        "familyName": "Areia Castro updated"

    },

    "emails": [

        {

            "value": testg.updated1@mgc.vh

        }

    ],

    "externalId": null,

    "active": true,

    "meta": {

        "resourceType": "User",

        "location": https://xxxxxxxxxxxxxxxxxxxxxxxx/scim/v2/Users/14,

        "lastModified": "2024-09-18T16:40:48.090Z",

        "created": "2024-09-16T09:14:44.947Z"

    },

    "roles": [

        {

            "value": "{\"value\": \"New Group 1\"}"

        }

    ]

}

I have checked with hardcoded value, but that doesnt work either.

{
    "call": [
        {
            "name": "call1",
            "connection": "acctAuth",
            "url": "https://xxxxxxxxxxxxxxxxxxxxxxxxxx/scim/v2/Users/14",
            "httpMethod": "PATCH",
            "httpParams": "{\"schemas\": [\"urn:ietf:params:scim:api:messages:2.0:PatchOp\"],\"Operations\": [{\"op\": \"replace\",\"path\": \"urn:ietf:params:scim:schemas:core:2.0:User:name.givenName\",\"value\": \"${user.firstname}\"},{\"op\": \"replace\",\"path\": \"urn:ietf:params:scim:schemas:core:2.0:User:name.familyName\",\"value\": \"${user.lastname}\"},{\"op\": \"replace\",\"path\": \"emails\",\"value\": [{\"value\": \"${user.email}\"}]}]}",
            "httpHeaders": {
                "Authorization": "${access_token}",
                "Content-Type": "application/scim+json"
            },
            "successResponses": {
                "statusCode": [200]
            }
        }
    ]
}

Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Hi Rushi,
already tried.
"Content-Type": "application/scim+json" and "Content-Type": "application/json" doesnt manke any difference. Thanks.

Share latest logs in text format


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

hi Rushi,

here is the log attached

parthaghosh
Regular Contributor
Regular Contributor

Hi All,

As mentioned by the Saviynt Office hours, I confirm that the Create operation is working fine which is a PUT call.

below is the JSON for Create account

{
"call": [
{
"name": "call1",
"connection": "acctAuth",
"url": "https://xxxxxxxxxxxxxxxxxxxxx/scim/v2/Users",
"httpMethod": "POST",
"httpParams": "{\"schemas\": [\"urn:ietf:params:scim:schemas:core:2.0:User\"],\"userName\": \"${user.username}\",\"active\": ${user.statuskey == 1?true:false},\"emails\": [{\"primary\": true,\"type\": \"work\",\"value\": \"${user.email}\"}],\"meta\": {\"resourceType\": \"User\"},\"name\": {\"formatted\": \"${user.displayname}\",\"familyName\": \"${user.lastname}\",\"givenName\": \"${user.firstname}\"}}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
]
}
}
],
"accountIdPath": "call1.message.id",
"responseColsToPropsMap": {}
}

So your http method was wrong POST instead of PATCH 


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

No Rushi,
Create call in POST - working
Update, ADDaccess, remove access are PATCH - not working

Please share postman screenshot and curl command [Refer https://codingnconcepts.com/postman/how-to-generate-curl-command-from-postman/ ]



⚠️‼️‼️Do not upload any attachments that contain sensitive information, such as IP Addresses, URLs, Company/Employee Names, Email Addresses, etc.‼️‼️⚠️


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

parthaghosh
Regular Contributor
Regular Contributor

this is the error for Update call


"call1": {
"headers": null,
"message": {
"status": "error",
"message": "An unexpected error occurred -2- please contact support for assistance."
},
"statusCode": 500,
"description": null,
"status": "Failed"
}