Skip to content

Instantly share code, notes, and snippets.

@dio
Created August 11, 2011 04:19
Show Gist options
  • Select an option

  • Save dio/1138895 to your computer and use it in GitHub Desktop.

Select an option

Save dio/1138895 to your computer and use it in GitHub Desktop.
GetGlue protected resource request
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