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
| puts response.body[0]["condition"] |
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
| curl -H "X-Mashape-Authorization: YOUR-AUTHORIZATION-CODE" "https://george-vustrey-weather.p.mashape.com/api.php?_method=getForecasts&location=San%20Francisco" |
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
| // Pseudo-code | |
| X-MASHAPE-AUTHORIZATION = BASE64(PUBLIC_KEY + ":" + HMAC_SHA1(PUBLIC_KEY, PRIVATE_KEY)) |
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
| # 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. |
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
| 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 |
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
| // 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. |
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
| $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(); |
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
| // 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. |
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
| 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(); |
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
| // 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. |