Getting Rate Limits

Provides rate limits for each API endpoint.

Entity: Help
Type: HelpType.RateLimits
Parameters/Filters:
Name Purpose Type Required
Resources Comma-separated list of endpoints to filter results on string no

v3.0 Example:
            var helpResponse =
                await
                    (from help in twitterCtx.Help
                     where help.Type == HelpType.RateLimits
                     select help)
                    .SingleOrDefaultAsync();

            if (helpResponse != null && helpResponse.RateLimits != null)
                foreach (var category in helpResponse.RateLimits)
                {
                    Console.WriteLine("\nCategory: {0}", category.Key);

                    foreach (var limit in category.Value)
                    {
                        Console.WriteLine(
                            "\n  Resource: {0}\n    Remaining: {1}\n    Reset: {2}\n    Limit: {3}",
                            limit.Resource, limit.Remaining, limit.Reset, limit.Limit);
                    }
                }
v2.1 Example:
            var helpResult =
                (from help in twitterCtx.Help
                 where help.Type == HelpType.RateLimits //&&
                       //help.Resources == "search,users"
                 select help)
                .SingleOrDefault();

            foreach (var category in helpResult.RateLimits)
            {
                Console.WriteLine("\nCategory: {0}", category.Key);

                foreach (var limit in category.Value)
                {
                    Console.WriteLine(
                        "\n  Resource: {0}\n    Remaining: {1}\n    Reset: {2}\n    Limit: {3}",
                        limit.Resource, limit.Remaining, limit.Reset, limit.Limit);
                }
            }

Twitter API: application/rate_limit_status

Last edited Nov 29, 2013 at 2:56 AM by JoeMayo, version 4