How to use Twitter Ads Api EndPoint in c#?

Can anyone help me how to create request to Twitter ads api? I have try to run example in this page GET accounts, i run that example URL to my browser but it give error "This page can't be reached". I want try to create this request without sdk, can anyone help me?

1 answer

  • answered 2018-07-12 04:51 MithunS

    Yes because you need to authenticate your request, there are multiple ways of doing so.

    Use an application like Postman to post your requests because it provides easy way to configure authentication as well, or you can try curl.

    Here is one such example, build authorization header

    Building the header string
    To build the header string, imagine writing to a string named DST.
    
    Append the string “OAuth ” (including the space at the end) to DST.
    For each key/value pair of the 7 parameters listed above:
    Percent encode the key and append it to DST.
    Append the equals character ‘=’ to DST.
    Append a double quote ‘”’ to DST.
    Percent encode the value and append it to DST.
    Append a double quote ‘”’ to DST.
    If there are key/value pairs remaining, append a comma ‘,’ and a space ‘ ‘ to DST.
    Pay particular attention to the percent encoding of the values when building 
    this string. For example, the oauth_signature value of 
    tnnArxj06cWHq44gCs1OSKk/jLY= must be encoded as tnnArxj06cWHq44gCs1OSKk%2FjLY%3D.
    
    OAuth oauth_consumer_key="xvz1evFS4wEEPTGEFPHBog", 
    oauth_nonce="kYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg", 
    oauth_signature="tnnArxj06cWHq44gCs1OSKk%2FjLY%3D", 
    oauth_signature_method="HMAC-SHA1", oauth_timestamp="1318622958", 
    oauth_token="370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb", 
    oauth_version="1.0"