I am writing an program to integrate with AppDirect. Link is: http://info.appdirect.com/developers/docs/api_integration/subscription_management
I successfully handle subscription order, change, and cancel events. Now, I want to send metered usage to appdirect and I followed instruction on this page http://info.appdirect.com/developers/docs/api_integration/subscription_management/metered_usage_api
However, it always returns me HTTP/1.1 401 Unauthorized and a long html page. This is my HTTP request to AppDirect:
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>
My program uses MVC5, CookieAwareWebClient to send http request (code: How do I log into a site with WebClient?)
Are there anything wrong in my request? Please let me know if you need more information. Any help would be highly appreciated. Thank heaps.