c# - 如何在 c# 中使用 Twitter Ads Api EndPoint?
问题描述
谁能帮助我如何创建对 Twitter 广告 API 的请求?我尝试在此页面GET 帐户中运行示例,我将该示例 URL 运行到我的浏览器,但它给出错误“无法访问此页面”。我想尝试在没有 sdk 的情况下创建此请求,有人可以帮我吗?
解决方案
是的,因为您需要验证您的请求,有多种方法可以这样做。
使用 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"
推荐阅读
- .net - 如何从 azure 管道中长时间运行的 webjob 获得响应
- html -
使用 CSS的替代方案 - powerbi - 如何在powerbi中有条件地将测量值转换为短信
- scala - Akka http 构建 Uri
- cassandra - 在Cassandra中根据频繁间隔的时间范围选择记录
- android - 从 WebView 代理中完全删除 Android 作为操作系统
- php - Symfony/Doctrine - 从实体构造函数获取记录?
- javascript - 使用 axios 时可能出现未处理的 Promise 拒绝、网络错误
- javascript - 在 DOM 加载后验证引导模式表单和模式加载
- git - 需要将本地文件夹 git repo 更改为另一个不同的 git repo