Creating WebRTC Phone using API/PowerShell

I've been fighting with getting this working and it just keeps erroring out saying that "Field 'templateId' is required and cannot be empty."

I found the below post, although old, and it has a fairly simple code that I've tried to emulate to no avail.

This post references the exact error and says that it was caused by lineBaseSettings being required but not in the JSON. I have this there but still cannot get it to work.

Updating remote phone adress through API - Platform API - Genesys Cloud Developer Forum

Here's what I have in the JSON Body. I've previously had a Name field under Lines but that's removed from this example:

{
    "webRtcUser":  {
                       "id":  "ID Value"
                   },
    "lines":  [
                  {
                      "lineBaseSetting":  {
                                              "id":  "ID Value"
                                          }
                  }
              ],
    "site":  {
                 "id":  "ID Value"
             },
    "name":  "Brad Hand - WebRTC",
    "phoneBaseSettings":  {
                              "id":  "ID Value"
                          }
}

And here's the direct PowerShell code:

    $WebRTCPhone = @{
        name = "Brad Hand - WebRTC"
        phoneBaseSettings = @{
            id = "ID Value"
        }
        webRtcUser = @{
            id = "ID Value"
        }
        site = @{
            id = "ID Value"
        }

        lines = @(
            @{
            lineBaseSetting = @{
                id = "ID Value"
                }
            }
        )
    }

    $WebRTCPhone | ConvertTo-Json -depth 5

Just so this is documented.... I missed the 'S' in lineBaseSettings!! >.> Such a rookie move and I just couldn't see it yesterday. Sometimes walking away and coming back the next day really helps. Below is working PowerShell code:

    $WebRTCPhone = @{
        name = "Brad Hand - WebRTC"
        phoneBaseSettings = @{
            id = "ID Value"
        }
        webRtcUser = @{
            id = "ID Value"
        }
        site = @{
            id = "ID Value" 
        }
        lines = @( 
            @{ 
            name = "Line1"
            lineBaseSettings = @{
                id = "ID Value"
            }
            }
        )
    }

    $WebRTCPhone | ConvertTo-Json -depth 3 | Out-File C:\Temp\WebRTCPhone.txt -force

    gc.exe telephony providers edges phones create -f C:\Temp\WebRTCPhone.txt

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