Nate Breeden avatar image
Nate Breeden asked Phong Vu answered

List Detailed Answering Rules in C#

(I know there is a parameter for detailed, please read) Is there another call to make for detailed instead of simple? In Python I would just add '"view" : "Detailed"' in my params and the output would let me parse through all of the detailed output. However, when adding the detailed param in C# the SDK doesn't have the detailed keys so it throws errors when trying to parse through them.


This is what I'm using

  1. ListAnsweringRulesParameters listAnsweringRulesParameters = new ListAnsweringRulesParameters
  2. {
  3. view = "Detailed",
  4. enabledOnly = true,
  5. };
  7. var handleIDs = await rc.Restapi().Account("~").Extension(;
  9. var fwdId = handleIDs.records[0].forwarding.rules[0].forwardingNumbers[0].id;
  10. var fwdType = handleIDs.records[0].forwarding.rules[0].forwardingNumbers[0].type;

The SDK doesn't have a "forwarding" key (in fwdId and fwdType) after "records[0]" so it throws me an error, even though I'm requesting a detailed list

Trying to use the ID/Type to set the users default answering rule, if there's a more simplistic way of doing it please let me know

rest apisdk
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Phong Vu avatar image
Phong Vu answered

I think the SDK has an issue to parse the response for the "Detailed" view. I will ask the SDK team to fix that. Meanwhile, you can work around the problem with this code:

public class DetailedAnsweringRuleInfo
            public string uri { get; set; }
            public string id { get; set; }
            public string type { get; set; }
            public string name { get; set; }
            public bool? enabled { get; set; }
            public ScheduleInfo schedule { get; set; }
            public CalledNumberInfo[] calledNumbers { get; set; }
            public CallersInfo[] callers { get; set; }
            public string callHandlingAction { get; set; }
            public ForwardingInfo forwarding { get; set; }
            public UnconditionalForwardingInfo unconditionalForwarding { get; set; }
            public QueueInfo queue { get; set; }
            public TransferredExtensionInfo transfer { get; set; }
            public VoicemailInfo voicemail { get; set; }
            public GreetingInfo[] greetings { get; set; }
            public string screening { get; set; }
            public SharedLinesInfo sharedLines { get; set; }
            public MissedCallInfo missedCall { get; set; }

public class CustomUserAnsweringRuleList
            public string uri { get; set; }
            public DetailedAnsweringRuleInfo[] records { get; set; }
            public UserAnsweringRuleListPaging paging { get; set; }
            public UserAnsweringRuleListNavigation navigation { get; set; }

static private async Task list_users_answering_rule_raw()
    ListAnsweringRulesParameters listAnsweringRulesParams = new ListAnsweringRulesParameters{
    view = "Detailed";
    enabledOnly = false;
    string endpoint = "restapi/v1.0/account/~/extension/~/answering-rule";
    var response = await rcsdk.Get(endpoint, listAnsweringRulesParams);
    var body = await response.Content.ReadAsStringAsync();            
    var result = JsonConvert.DeserializeObject<CustomUserAnsweringRuleList>(body);
    foreach (var record in result.records)
        dynamic jsonStr = JsonConvert.SerializeObject(record);
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys