04-05-2026 04:02 PM
I am trying to write a PowerShell script to add devices to a virtual line, turn on Hotline, and add the extension under the custom behavior tab.
I have the script to get the virtual line ID and the device ID.
Not sure if my body is correct that the URI uses.
It is possible that my URI isn't correct. I have tried both RestMethod and WebexRequest each with POST, PUT, and UPDATE
Does anyone have anything they would like to share, or a link that provides better information?
Thanks
Randy
04-15-2026 09:21 AM
I'm not as familiar with Powershell, but I have done this in python. You will be making the changes to each device's members so you'll need a each device's ID that you want to update. Then you'll need the virtual line's ID to add it to them. Members can be a little weird to work with since you will have to get the existing members, and then append on a new line.
https://developer.webex.com/calling/docs/api/v1/device-call-settings/get-device-members
This will return your current members object. Then you can use the PUT (https://developer.webex.com/calling/docs/api/v1/device-call-settings/update-members-on-the-device) to append the additional member. Below is an example PUT. It might not be 100% but should get you fairly close. I've removed some of my personal info from the original line from the GET. Below I already had port 1 assigned for my primary line, and then added in port 2 with the PUT. For anyone else that comes across this that may be using python instead of powershell, wxc_sdk has a lot of this functionality built out and ready for use. (https://wxc-sdk.readthedocs.io/en/1.32.0/apidoc/wxc_sdk.telephony.devices.html#wxc_sdk.telephony.devices.TelephonyDevicesApi.update_members). Note, this does not cover layouts so if you are using a custom layout, you would then also need to update the layout to include the new shared line.
curl -L --request PUT \
--url https://webexapis.com/v1/telephony/config/devices/{deviceId}/members \
--header 'Authorization: Bearer XXXXXXXXXX' \
--header 'Content-Type: application/json' \
--data '{
"members": [
{
"id": "XXXXXXXXXXXXXXXXXXXXXXXXX",
"firstName": "Michael",
"lastName": "Ralston",
"phoneNumber": "XXXXXXXXXX",
"extension": "XXXX",
"esn": "XXXX",
"primaryOwner": true,
"port": 1,
"lineType": "SHARED_CALL_APPEARANCE",
"lineWeight": 8,
"hotlineEnabled": false,
"allowCallDeclineEnabled": true,
"memberType": "PEOPLE",
"lineLabel": "Test Line Label",
},
{
"port": 2,
"id": "virtuallineid",
"lineType": "SHARED_CALL_APPEARANCE",
"hotlineEnabled": true,
"hotlineDestination": "5555",
"lineLabel": "newly added member"
}
]
}'
04-06-2026 11:28 AM
I have a function that seems to work with PUT, but after running it, the device isn't actually added to the virtual line.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide