有人能帮我如何创建Twitter广告api请求吗?我试着在这个页面中运行示例GET帐户,我在浏览器中运行了那个示例URL,但它给出了错误"无法访问这个页面"。我想尝试在没有sdk的情况下创建这个请求,有人能帮我吗?
是的,因为您需要验证您的请求,有多种方法可以做到这一点。
- 基本身份验证
- OAuth
使用Postman这样的应用程序来发布您的请求,因为它也提供了配置身份验证的简单方法,或者您可以尝试curl。
这里有一个这样的例子,构建授权头
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"