Legacy Dev Forum Posts

 View Only

Sign Up

Change name of Phone receives 400 error

  • 1.  Change name of Phone receives 400 error

    Posted 06-05-2025 18:18

    Ronald_Gray | 2020-10-30 20:39:26 UTC | #1

    When attempting to change the name on a current phone, the response is: { "message": "A web rtc phone has already been assigned to this user.", "code": "bad.request", "status": 400, "details": [ { "errorCode": "ONLYONEWEBRTCASSIGNMENT_ALLOWED", "fieldName": "webRtcUser" } ] }

    Well, I know that. I want to change the name.

    Here is the 'PUT' request:

    put /api/v2/telephony/providers/edges/phones/<phone ID>

    { "name": "<New Name for Phone>", "webRtcUser": { "id": "<Currently Assigned User's GUID>" }, "phoneBaseSettings": { "id": "<Long GUID goes here>", "selfUri": "/api/v2/telephony/providers/edges/phonebasesettings/<Long GUID goes here>" }, "lines": [ { "id": "<Another Long GUID goes here>", "state": "active", "selfUri": "/api/v2/telephony/providers/edges/lines/<Another Long GUID goes here>" } ] }


    Jerome.Saint-Marc | 2020-11-04 13:26:56 UTC | #2

    Hello,

    A first option would be to retrieve the phone with a GET /api/v2/telephony/providers/edges/phones/\<phone ID\>. Then change the name attribute value in the structure with the new phone name. And update it, pushing the full structure with a PUT /api/v2/telephony/providers/edges/phones/\<phone ID\>

    I have also tried to find the minimum info I needed to update my phone name with a PUT /api/v2/telephony/providers/edges/phones/\<phone ID\> It looks like this:

    { "name": "My new phone name", "site": { "id": "---Id of Site---" }, "phoneBaseSettings": { "id": "---ID of Phone Base Settings---" }, "lines": [ { "id": "---ID of line---", "lineBaseSettings": { "id": "---ID of Line Base Settings---" } } ], "webRtcUser": { "id": "---ID of webbRtcUser---" } }

    Regards,


    Ronald_Gray | 2020-11-03 21:36:46 UTC | #3

    Adding the "lineBaseSettings" inside the "lines" list worked like a charm...Curious as to why it is not returned like that in the original GET request (it is a stand alone config item).

    Thank you for the response.

    sent data header = { "name": "New_NAME","site": { "id": "---SITE ID---" }, "phoneBaseSettings": { "id": "---PHONE BASE SETTINGS ID ---" }, "lines": [ { "id": "---LINE ID---", "lineBaseSettings": { "id": "---LINE BASE SETTING ID---" } } ], "webRtcUser": { "id": "---USER ID---" } }

    Response was "200 Success"


    John_Carnell | 2020-11-03 21:42:44 UTC | #4

    Hi Ronald,

    In general, PUT requires you to submit the exact same structure as you would get in a GET statement because it is replacing the resource not just updating. In REST, a PATCH is used for doing an individual update of a set of fields, but many vendors (including us) do not support PATCH consistently in their API. I am going to forward your question about why the GET does not return line information to the dev team.

    I hope that helps.

    Thanks, John Carnell


    Ronald_Gray | 2020-11-03 21:42:36 UTC | #5

    Thank you John.


    Matt.Durham | 2020-11-04 12:51:03 UTC | #6

    GET /api/v2/telephony/providers/edges/phones does not return the lineBaseSettings by default to reduce the size of the response. If the field is desired, they can be requested by specifying the expand query parameter with a value of lines.

    Requesting a specific phone with GET /api/v2/telephony/providers/edges/phones/{phoneId} returns the lineBaseSettings in the response.


    system | 2020-12-05 12:51:06 UTC | #7

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


    This post was migrated from the old Developer Forum.

    ref: 9209