Get help/configuration

Mar 20, 2015 at 3:43 PM
Is there a method in TweetInvi for getting the help/configuration API endpoint?
I was looking in the Help class, but could only see GetTwitterPrivacyPolicy()

If not, how is the best way to get this data (since I also cannot see a corresponding DTO)?

Thanks!
Coordinator
Mar 20, 2015 at 4:14 PM
Edited Mar 20, 2015 at 4:21 PM
Hi,

Yes it is not implemented because no one requested it until now. But as you just did, I added the Work Item to be available in the next release (0.9.6.0).

Work Item

In the meantime here is what you need to do.

1 - Reference Newtonsoft.Json in your project (use nuget, Install-Package Newtonsoft.Json).
2 - Create the following model representing the json of the configuration endpoint:
public class TwitterConfiguration
{
    [JsonProperty("characters_reserved_per_media")]
    public int CharactersReservedPerMedia { get; private set; }

    [JsonProperty("max_media_per_upload")]
    public int MaxMediaPerUpload { get; private set; }

    [JsonProperty("non_username_paths")]
    public string[] NonUsernamePaths { get; private set; }

    [JsonProperty("photo_size_limit")]
    public int PhotoSizeLimit { get; private set; }

    [JsonProperty("photo_sizes")]
    public Dictionary<string, MediaEntitySize> PhotoSizes { get; private set; }

    [JsonProperty("short_url_length")]
    public int ShortURLLength { get; private set; }

    [JsonProperty("short_url_length_https")]
    public int ShortURLLengthHttps { get; private set; }
}
3 - Invoke the endpoint:
var configuration = TwitterAccessor.ExecuteGETQuery<TwitterConfiguration>("https://api.twitter.com/1.1/help/configuration.json");
And here you go ;)
Regards,
Linvi
Marked as answer by linvi on 3/20/2015 at 8:33 AM
Mar 20, 2015 at 4:48 PM
Thank you very much for your quick response!