cancel
Showing results for 
Search instead for 
Did you mean: 
KorzeGrz
Occasional Member - Level 1

API Patch user's Spend or Travel Profile

Hello,

 

I use User Provisioning v4 API to create users. I can also use its PATCH method to modify user's Identity Profile. Now I'm wondering if there's any way to update user's Spend or Travel profile as well using API? I tried different approaches (documented on screenshots below) with no success.

 

Thank you in advance for any help!

 

Kind regards,

GK

 

2023-08-04 10_00_42-Patch User By ID - Electrolux.png2023-08-04 10_00_25-Patch User By ID - Electrolux.png2023-08-04 10_00_00-Patch User By ID - Electrolux.png2023-08-04 09_59_43-Patch User's Spend Profile - Electrolux.png

7 REPLIES 7
TChapman
SAP Concur Employee
SAP Concur Employee

No, PATCH {{Host}}/profile/Identity/v4/Users/{{UserID}} will only affect the Identity schema.  use PATCH {{Host}}/profile/v4/Users/{{UserID}} to be able to change the "path" urn:ietf:params:scim:schemas:extension:spend:2.0:User schema.

 

You should also be able to use profile.v4.Users to update the identity as well, but for path use the identity schema.  For example:

{
            "op": "replace",
            "path": "userName",
            "value": "John10_9_1_Replacement@sap.com"
        }

You can always open a case with Concur for deeper help with APIs.  

cocchino
Occasional Member - Level 1

Hello TChapman and KorzeGrz,

 

I'm getting the same error. Can I get a sample payload of the PATCH /profile/v4/Users/{{UserID}} example? I keep trying to update an enterprise user schema item. Spoiler alert, it's a user error by me:

 

{
"mnemonic": "/profile/v4/Users/UUID",
"verb": "patch",
"request_type": "json",
"response_type": "json",
"path": "/profile/identity/v4.1/Users/XXXXXX-XXXX-XXXX-XXXX-XXXXXXX",
"input": {
"schema": "[{\"name\":\"schemas\",\"type\":\"array\",\"of\":\"string\",\"control_type\":\"text\",\"label\":\"Schemas\",\"details\":{\"real_name\":\"schemas\"}},{\"name\":\"Operations\",\"type\":\"array\",\"of\":\"object\",\"label\":\"Operations\",\"properties\":[{\"control_type\":\"text\",\"label\":\"Op\",\"type\":\"string\",\"name\":\"op\",\"details\":{\"real_name\":\"op\"},\"optional\":false,\"hint\":\"op\"},{\"control_type\":\"text\",\"label\":\"Path\",\"type\":\"string\",\"name\":\"path\",\"details\":{\"real_name\":\"path\"},\"optional\":false,\"hint\":\"path\"},{\"control_type\":\"text\",\"label\":\"Value\",\"type\":\"string\",\"name\":\"value\",\"details\":{\"real_name\":\"value\"},\"optional\":false,\"hint\":\"value\"}],\"details\":{\"real_name\":\"Operations\"}}]",
"data": {
"schemas": "\"urn:ietf:params:scim:api:messages:2.0:PatchOp\"",
"Operations": [
{
"op": "replace",
"path": "urn:ietf:params:scim:schemas:extension:spend:2.0:User.division",
"value": "My Division"
}
]
}
}


{
"status": 400,
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:Error",
"urn:ietf:params:scim:api:messages:concur:2.0:Error"
],
"urn:ietf:params:scim:api:messages:concur:2.0:Error": {
"messages": [
{
"code": "BAD_INPUT",
"type": "error",
"schemaPath": "urn:ietf:params:scim:schemas:extension:spend:2.0:User.division"
}
]
},
"scimType": "invalidPath",
"detail": "Invalid path element"
}

TChapman
SAP Concur Employee
SAP Concur Employee

assuming "division" is the correct field, you should be using a : not a .

 

For the original request, they would be doing:


PATCH https://{datacenterURI}/profile/v4/Users/<Concur UUID>
 
{
    "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:PatchOp"
    ],
    "Operations": [
        {
            "op": "replace",
            "path": "urn:ietf:params:scim:schemas:extension:spend:2.0:User:locale",
            "value": "en-US"
        }
]
}
cocchino
Occasional Member - Level 1

I can't think you enough for the quick response. Tried changing to a semi colon and referred to the user schema documentation to hopefully use the right path. Should I be using the v4 or the v4.1 API call? Something else I'm doing wrong? https://developer.concur.com/api-reference/profile/v4.identity.html#schema-user

 

{"code":"BAD_INPUT","type":"error","schemaPath":"urn:ietf:params:scim:schemas:core:2.0:Schema:division"}]},"scimType":"invalidPath","detail":"Invalid path element"}

 

 

 

cocchino
Occasional Member - Level 1

I think I got it. the correct path is:

urn:ietf:params:scim:schemas:extension:enterprise:2.0:User:division

 

Thank you for all your help!

cocchino
Occasional Member - Level 1

Could I trouble you with one more question. Trying to replace a custom field. Not getting an error but the field isn't getting replaced. Is this syntax correct?

 

            "op": "replace",
            "path": "urn:ietf:params:scim:schemas:extension:spend:2.0:User:customData[id eq \"custom1\"].value",
            "value": "My New Value"

Also my division isn't replacing either. Is there a schema.xsd out there for reference?
mvatani
Occasional Member - Level 2

When I query the user in Concur using API, I am not able to get a spend profile page. Can you advise how can i do it? Just thought to check if you have any clue?