I am currently writing a utility to get the current caller-id settings for all of our extensions (1900+) and then someone will be doing some magic work in excel, and then reuploading the changes to a certain number of rows. Anyway I am just trying to update a single record at this point and here is what I have:
CallerIdMainClass cidMC = new CallerIdMainClass();
List<ByFeature> byf = new List<ByFeature>(); cidMC.byFeature = new List<ByFeature>(); if (ext.alternate != "") { ByFeature feat = new ByFeature(); feat.feature = "Alternate"; CallerId cid = new CallerId(); cid.type = "PhoneNumber"; PhoneInfo pi = new PhoneInfo(); pi.id = ext.alternateId; pi.phoneNumber = ext.alternate; pi.uri = ext.alternateUri; cid.phoneInfo = pi; feat.callerId = cid; cidMC.byFeature.Add(feat); } cidMC.uri = "https://platform.devtest.ringcentral.com/restapi/v1.0/account/237848004/extension/237848004/caller-id"; var request = JsonConvert.SerializeObject(cidMC, Formatting.Indented); var response = await rcClient.Extension(dr["extensionId"].ToString()).CallerId().Put(request);
request becomes this:
{ "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/237848004/extension/237848004/caller-i...;,
"byFeature": [
{
"feature": "Alternate",
"callerId": {
"type": "PhoneNumber",
"phoneInfo": {
"id": "322761004",
"uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/237848004/phone-number/322761004";,
"phoneNumber": "+13128589611"
}
}
}
]
}
However I am getting a 400 Bad Request back. What am I doing wrong?