如何在C#中使用Twitter Ads Api EndPoint?

时间:2018-07-12 04:27:21

标签: c# .net twitter ads-api

有人可以帮助我如何创建对Twitter Ads API的请求吗?我尝试在此页面GET accounts中运行示例,我将该示例URL运行到我的浏览器中,但显示错误“无法访问此页面”。我想尝试在没有sdk的情况下创建此请求,有人可以帮助我吗?

1 个答案:

答案 0 :(得分:1)

是的,因为您需要对请求进行身份验证,所以可以通过多种方式进行验证。

使用Postman之类的应用程序发布您的请求,因为它还提供了一种配置身份验证的简便方法,或者您可以尝试curl。

这里是一个这样的示例,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"