2015-02-02 5 views
2

저는 AppDirect와 통합하기위한 프로그램을 작성 중입니다. 링크 : http://info.appdirect.com/developers/docs/api_integration/subscription_management계량 된 사용을 AppDirect로 보내는 방법

구독 주문, 변경 및 취소 이벤트를 성공적으로 처리합니다. 이제 appdirect에 metered usage를 보내고 싶습니다.이 페이지의 지시를 따랐습니다. http://info.appdirect.com/developers/docs/api_integration/subscription_management/metered_usage_api

그러나 항상 HTTP/1.1 401 Unauthorized 및 긴 html 페이지를 반환합니다.

내 요청에 아무 잘못이 있습니다, CookieAwareWebClient는 HTTP 요청 ( How do I log into a site with WebClient? 코드)를 보내

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를 사용이 AppDirect 내 HTTP 요청입니까? 자세한 정보가 필요하면 알려주십시오. 어떤 도움을 주시면 감사하겠습니다. 고맙습니다.

답변

2

나는 무슨 일이 일어 났는지 알아 냈습니다. OAuth Signature 계산이 잘못되었습니다. OAuth 계산에 포함 된 HTTP 메소드는 GET 이었지만 POST라고 가정합니다.

POST로 변경하는 즉시 작동합니다.