c# - Quickbook online service gives 500 internal server? -
i trying call data service got 500 error every time. when tested using "try it" button in api explorer, worked. response came fine. in app, failed connect. same oauth header worked api not inside app.
string urlreq = "https://qbo.sbfinance.intuit.com/resource/companymetadata/v2/" + intuitrealmid; //static baseurl uri uritointuit = new uri(urlreq); httpwebrequest intuitreq = (httpwebrequest)webrequest.create(uritointuit); intuitreq.method = "get"; intuitreq.contenttype = "text/xml"; intuitreq.contentlength = 0; intuitreq.accept = "text/xml"; oauthutils.signrequest(intuitreq, ap.consumerkey, ap.consumersecret, rtoken.token,rtoken.tokensecret); httpwebresponse httpresponse = (httpwebresponse)(intuitreq.getresponse());
...
public static void signrequest(httpwebrequest request, string consumerkey, string consumersecret, string token, string tokensecret) { string normalizedurl; string normalizedrequestparameters; string timestamp = oauthutils.generatetimestamp(); string nonce = oauthutils.generatenonce(); oauthconsumerbase consumerbase = new oauthconsumerbase(); string signature = consumerbase.generatesignature( request.requesturi, null, // callback, null, // verifier, consumerkey, consumersecret, token, // token, null, // type, tokensecret, // tokensecret, request.method, timestamp, nonce, null, // status, out normalizedurl, out normalizedrequestparameters ); string authheader = oauthrequest.generateauthheader( nonce, timestamp, signature, token, consumerkey, null, // verifier null, // callback "hmac-sha1", // signature type "1.0" // version ); request.headers[httprequestheader.authorization] = authheader; }
i have tried static baseurl gives 500 error. https://qbo.intuit.com/qbo1/rest/user/v2/
oauth oauth_version=\"1.0\", oauth_nonce=\"c830ffa8338b4d6fa0b3e8d03f144642\", oauth_timestamp=\"1374015013\", oauth_consumer_key=\"qyprdpwcmwyde7nfbkg4mb0t65ufh8\", oauth_token=\"qyprdtnnwciborqk9l93o8erkpzi3elobuhbrulzvsxpspmu\", oauth_signature_method=\"hmac-sha1\", oauth_signature=\"ws0wpqmv9aazafhw%2b6wmc5aidbk%3d\"" string
you can download sample app dotnet from: https://developer.intuit.com/docs/0025_quickbooksapi/0055_devkits/sample_code
just enter key values in web.config , should set.
Comments
Post a Comment