Skip to content

Instantly share code, notes, and snippets.

View subnetmarco's full-sized avatar
🦍
Hiring, Thinking, Coding

Marco Palladino subnetmarco

🦍
Hiring, Thinking, Coding
View GitHub Profile
puts response.body[0]["condition"]
curl -H "X-Mashape-Authorization: YOUR-AUTHORIZATION-CODE" "https://george-vustrey-weather.p.mashape.com/api.php?_method=getForecasts&location=San%20Francisco"
// Pseudo-code
X-MASHAPE-AUTHORIZATION = BASE64(PUBLIC_KEY + ":" + HMAC_SHA1(PUBLIC_KEY, PRIVATE_KEY))
# The OAuth callback URL is a custom URL where we will redirect the user after he has granted the permissions to an application. We will submit his Access Token and the Access Secret as parameters.
twitterClient = Twitter.new("MASHAPE_KEY", "OAUTH_CONSUMER_KEY", "OAUTH_SECRET", "OAUTH_CALLBACK_URL")
redirectUrl = twitterClient.get_oauth_url("optional scope").body["url"]
# You can now redirect the user to the redirectUrl.
twitterClient.authorize("OAUTH_ACCESS_TOKEN", "OAUTH_ACCESS_SECRET") # We authenticate the user
response = twitterClient.mentions() # Now we can consume the endpoint
response = twitterClient.updateStatus("new status")
# You can also use the following style
response = twitterClient.authorize("OAUTH_ACCESS_TOKEN", "OAUTH_ACCESS_SECRET").mentions
// The OAuth callback URL is a custom URL where we will redirect the user after he has granted the permissions to an application. We will submit his Access Token and the Access Secret as parameters.
$twitterClient = new Twitter("MASHAPE_KEY", "OAUTH_CONSUMER_KEY", "OAUTH_SECRET", "OAUTH_CALLBACK_URL");
$redirectUrl = $twitterClient->getOAuthUrl()->body->url;
// You can now redirect the user to the $redirectUrl.
$twitterClient->authorize("OAUTH_ACCESS_TOKEN","OAUTH_ACCESS_SECRET"); // We authenticate the user
$response = $twitterClient->mentions(); // Now we can consume the endpoint
$response = $twitterClient->updateStatus("new status");
// You can also use the following style
$response = $twitterClient->authorize("OAUTH_ACCESS_TOKEN","OAUTH_ACCESS_SECRET")->mentions();
// The OAuth callback URL is a custom URL where we will redirect the user after he has granted the permissions to an application. We will submit his Access Token and the Access Secret as parameters.
Twitter twitterClient = new Twitter("MASHAPE_KEY", "OAUTH_CONSUMER_KEY", "OAUTH_SECRET", "OAUTH_CALLBACK_URL");
String redirectUrl = client.getOAuthUrl().getBody().getString("url");
// You can now redirect the user to the redirectUrl.
twitterClient.authorize("OAUTH_ACCESS_TOKEN", "OAUTH_ACCESS_SECRET"); // We authenticate the user
MashapeResponse<JSONArray> response = twitterClient.mentions(); // Now we can consume the endpoint
MashapeResponse<JSONObject> response2 = twitterClient.updateStatus("new status");
// You can also use the following style
response = twitterClient.authorize("OAUTH_ACCESS_TOKEN", "OAUTH_ACCESS_SECRET").mentions();
// The OAuth callback URL is a custom URL where we will redirect the user after he has granted the permissions to an application. We will submit his Access Token and the Access Secret as parameters.
Twitter* twitterClient = [[Twitter alloc] initAuthentication:@"MASHAPE-KEY" consumerKey:@"OAUTH_CONSUMER_KEY" consumerSecret:@"OAUTH_SECRET" redirectUrl:@"OAUTH_CALLBACK_URL"];
NSString* redirectUrl = [[[twitterClient getOAuthUrl] body] objectForKey:@"url"];
// You can now redirect the user to the redirectUrl.