Modify Phone attributes of a Cloudsoc user profile via management APIs
search cancel

Modify Phone attributes of a Cloudsoc user profile via management APIs

book

Article ID: 267702

calendar_today

Updated On:

Products

CASB Advanced Threat Protection CASB Audit CASB Gateway CASB Gateway Advanced CASB Security Advanced CASB Security Advanced IAAS CASB Security Premium CASB Security Premium IAAS CASB Security Standard CASB Securlet IAAS CASB Securlet SAAS CASB Securlet SAAS With DLP-CDS

Issue/Introduction

Using the "User Management API", Cloudsoc user accounts can be created, updated and deleted. Among of the attributes that can be updates via API's is both "Work Phone" and "Mobile Phone" , for these two attributes. This article gives an example on how to enter a valid phone number.

Cause

As the case in the Cloudsoc UI, the phone attributes requires the "Country Code" to be supplied along with the phone number. Otherwise, it won't be considered as a valid number it will be ignored.

Resolution

 

The valid phone number for the User API is in this format 

<Country Code> + "-" + <Phone number>

 

for example:

1- Invalid phone value: 

In this example, this phone number is not valid because the country code is not supplied, if used as a payload, the phone number will be ignored and no change will be made to the existing values. The response body will show the old value (Empty in this example)

{"work_phone": "8005550100"}

 

Request

%USERPATH%> $PayloadTextUpdate = '{"work_phone": "8005550100"}'
%USERPATH%> $Response = Invoke-WebRequest -uri $EndpointUpdate -Headers $Headers -Method PATCH -Body $PayloadTextUpdate

Response

%USERPATH%> $Response.Content
{"cell_phone": "", "created_by": "[email protected]", "created_on": "2023-06-02T14:58:42.684000", "email": "[email protected]", "first_n
ame": "APIUSER", "groups": ["GRP01", "GRP02"], "is_active": true, "last_name": "APILASTNAME", "modified_by": "[email protected]", "modified_on": "2023-06-02T19:14:32.918872", "resource_uri": "/examplecom/api/admin/v1/user_management/999a99a99d99e999b9d9c999/", "secondary_user_id"
: "cloudsocdomain\\apiuser", "title": "Mr", "work_phone": ""}

2- Valid phone value:

This example, is valid because the country code is supplied, if used as a payload, the phone number will be updated and the new value will override the existing value. The final result will be reported in the response body.

Request

%USERPATH%> $PayloadTextUpdate = '{"work_phone": "1-8005550100"}'
%USERPATH%> $Response = Invoke-WebRequest -uri $EndpointUpdate -Headers $Headers -Method PATCH -Body $PayloadTextUpdate

Response

%USERPATH%> $Response.Content
{"cell_phone": "", "created_by": "[email protected]", "created_on": "2023-06-02T14:58:42.684000", "email": "[email protected]", "first_n
ame": "APIUSER", "groups": ["GRP01", "GRP02"], "is_active": true, "last_name": "APILASTNAME", "modified_by": "[email protected]", "modified_on": "2023-06-02T19:14:32.918872", "resource_uri": "/examplecom/api/admin/v1/user_management/999a99a99d99e999b9d9c999/", "secondary_user_id"
: "cloudsocdomain\\apiuser", "title": "Mr", "work_phone": "1-8005550100"}