Created
August 11, 2011 04:19
-
-
Save dio/1138895 to your computer and use it in GitHub Desktop.
GetGlue protected resource request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void Glued::queryObject(QString query) { | |
| oauthRequest->initRequest(KQOAuthRequest::AuthorizedRequest,QUrl("http://api.getglue.com/v2/glue/findObjects")); | |
| oauthRequest->setHttpMethod(KQOAuthRequest::GET); | |
| // consumer key & secret | |
| oauthRequest->setConsumerKey("ab900d9ba1e5d3466a166a3bc1c9f285"); | |
| oauthRequest->setConsumerSecretKey("7526b9667b4daa78a805428c006263f2"); | |
| // access token & secret | |
| oauthRequest->setToken(accessToken); | |
| oauthRequest->setTokenSecret(accessTokenSecret); | |
| // params: e.g. http://endpoi.nt?q=catatan&format=json | |
| KQOAuthParameters params; | |
| params.insert("q", query); | |
| params.insert("format", "json"); | |
| oauthRequest->setAdditionalParameters(params); | |
| // execute request | |
| oauthManager->executeRequest(oauthRequest); | |
| // connections | |
| connect(oauthManager, SIGNAL(requestReady(QByteArray)), | |
| this, SLOT(onRequestReady(QByteArray))); | |
| connect(oauthManager, SIGNAL(authorizedRequestDone()), | |
| this, SLOT(onAuthorizedRequestDone())); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment