ads API Support

May 4, 2015 at 2:29 PM
I am planning on using Tweetinvi with the ads API
is there a support for it
or at least is there a way to send POST and GET requests using Tweetinvi ?
May 4, 2015 at 4:54 PM

I have never tested the Ads API of Twitter. I first need to finish implementing the REST API before I can continue on more.
From what I was able to read, Tweetinvi should be able to access the Ads API thanks to the Twitter Accessor.
var json = TwitterAccessor.ExecuteJsonGETQuery("");
Now you need to be careful because it seems like the application need to have special authorization in order to access the Ads API.

I do not have any knowledge about this, so please get some info on your end.

Please keep me up to date. I am very interested in bringing this feature after the release 1.0 Tweetinvi. Any feedback could be very valuable.

May 4, 2015 at 5:07 PM
Thanks Linvi,
As for the Ads API you need special access to use it and we're currently working on getting the access
The GET Call seems what I need I have never seen it in tweetinvi ,how about post requests , how can I send parameteres using the POST request?
Whenever we get the access and implement I'll share my implementation so it will be easier to implement at ur end later on
May 4, 2015 at 5:12 PM
Edited May 4, 2015 at 5:13 PM

The TwitterAccessor is full of useful methods you can use to do any request you want. All WebRequests in Tweetinvi uses the TwitterAccessor.
You can for example get a Model from the Json response by just specifying the type of object you want as a Generic.
public class Ad
    public long Id { get; set; }
    public long Title { get; set; }

// Execute POST request
var ad = TwitterAccessor.ExecutePOSTQuery<Ad>("https://ads-api/createNewAd");
This will automatically handle exceptions for you and return null if any occurred (if the ExcetpionHandler is turned on).

May 4, 2015 at 5:17 PM
Where should I look for in order to have the special authorization you mentioned?

May 4, 2015 at 5:18 PM
Thanks Again Linvi for the instant reply,
To be more precise I have been using the Facebook Ads API and facebook C# SDK say I have a post like,new
is there an equivalent way in tweetinvi to send values just like that ?
May 4, 2015 at 5:20 PM
May 4, 2015 at 5:26 PM

Thanks for the info, I will have a look into it so that I can help you with more accuracy.

I have never thought about adding the parameters this way. I could add this feature in 0.9.9.x but it will not be available before 2 months at least.
At the current time you will have to generate the URL with the parameters on your own but you use a StringExtension available in Tweetinvi:
var ad = TwitterAccessor.ExecutePOSTQuery<Ad>("https://ads-api/createNewAd"
                .AddParameterToQuery("value1", "v1")
                .AddParameterToQuery("value2", "v2"));
May 4, 2015 at 5:34 PM
Edited May 4, 2015 at 5:34 PM
Thanks for your help , I'll look into it more closely
May 4, 2015 at 11:33 PM
I have applied for the Ads API. I will let you if and when I have access.