我正在编写一个与AppDirect集成的程序。链接为:http : //info.appdirect.com/developers/docs/api_integration/subscription_management
我成功处理了订购顺序,更改和取消事件。现在,我想将计量使用情况发送到appdirect,并按照此页面上的说明进行操作http://info.appdirect.com/developers/docs/api_integration/subscription_management/metered_usage_api
但是,它总是返回我HTTP / 1.1 401未经授权和一个很长的html页面。这是我对AppDirect的HTTP请求:
POST https://www.appdirect.com/api/integration/v1/billing/usage?oauth_consumer_key=mykey&oauth_nonce=775137&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1422880351&oauth_version=1.0&oauth_signature=q17RzR1KvuxHXvle0Uxrnn16IIA%3d HTTP/1.1
Content-Type: application/xml
Host: www.appdirect.com
Content-Length: 318
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
<?xml version="1.0" encoding="utf-16"?>
<usage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<account>
<accountIdentifier>123456</accountIdentifier>
</account>
<item>
<unit>DOCUMENT</unit>
<quantity>10</quantity>
</item>
</usage>
我的程序使用MVC5,CookieAwareWebClient发送http请求(代码:如何使用WebClient登录到站点?)
我的要求有什么问题吗?如果您需要更多信息,请告诉我。任何帮助将不胜感激。谢谢堆。
我知道发生了什么事。这是错误的OAuth签名计算。OAuth计算中包括的HTTP方法是GET,但假定是POST。
一旦将其更改为POST,它就会起作用。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句