scm_pa | 2020-04-07 14:39:41 UTC | #1
Hi. I'm using PutTelephonyProvidersEdgesPhonebasesetting() to modify the settings for a phone base. I make the modifications and then call PutTelephonyProvidersEdgesPhonebasesetting() and it returns successfully but when I check the settings for the phone base my modified setting did not occur. I have some test code below. This is not the final code, I'm just playing around to make sure I can make the API call.
if (phoneBase.Properties.TryGetValue("phonemediaportStartRange", out objValue)) { JObject jObject = (JObject)objValue; string serializedObject = JsonConvert.SerializeObject(jObject); serializedObject = "{\"type\":\"integer\",\"minimum\":1024,\"maximum\":65535,\"value\":{\"default\":16384,\"instance\":16385}}"; object deserializedObject = JsonConvert.DeserializeObject(serializedObject); jObject["value"] = (Newtonsoft.Json.Linq.JToken)deserializedObject; // newValue; phoneBase.Properties["phonemediaportStartRange"] = jObject;
// Update a Phone Base Settings by ID TelephonyProvidersEdgeApi apiInstance = new TelephonyProvidersEdgeApi(); PhoneBase result = apiInstance.PutTelephonyProvidersEdgesPhonebasesetting(phoneBase.Id, phoneBase); int x = 1; }
When I step through the debugger I see my modification in phoneBase.Properties but when the API call is made the returned PhoneBase does not have my modification in it. Any insight is appreciated. Thank you.
Jerome.Saint-Marc | 2020-04-07 16:01:59 UTC | #2
Hello,
I haven't tried from .Net but using the developer tools and the Platform API (REST) directly. The name, phoneMetaBase and lines are tagged as required (and doing the test - they are - otherwise the request returns a 400 Bad Request). API: https://developer.mypurecloud.com/api/rest/v2/telephonyprovidersedge/
So I would suggest you create your phoneBase parameter copying name/phoneMetaBase/lines attributes you got from a GET on the phone base settings. And add your properties.phonemediaportStartRange attribute into it (no need to copy the other properties).
scm_pa | 2020-04-07 17:41:50 UTC | #3
Thank you for the reply. I already have those set. The phone base has already been created at that point and the PhoneBase in use above is the PhoneBase returned from a successful call to PostTelephonyProvidersEdgesPhonebasesettings(). Or are you saying that I need to do a separate GET of the newly created phone base and then modify from there?
Thanks.
scm_pa | 2020-04-07 18:44:10 UTC | #5
Ok, I got it. Found the error in my code. I needed to update phoneBase.Properties["phonemediaportStartRange"] with deserializedObject instead.
if (phoneBase.Properties.TryGetValue("phonemediaportStartRange", out objValue)) { JObject jObject = (JObject)objValue; string serializedObject = JsonConvert.SerializeObject(jObject); serializedObject = "{\"type\":\"integer\",\"minimum\":1024,\"maximum\":65535,\"value\":{\"default\":16384,\"instance\":16385}}"; object deserializedObject = JsonConvert.DeserializeObject(serializedObject); phoneBase.Properties["phonemediaportStartRange"] = deserializedObject; // Update a Phone Base Settings by ID TelephonyProvidersEdgeApi apiInstance = new TelephonyProvidersEdgeApi(); PhoneBase result = apiInstance.PutTelephonyProvidersEdgesPhonebasesetting(phoneBase.Id, phoneBase); int x = 1; }
Thank you.
system | 2020-05-08 18:44:12 UTC | #6
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: 7500