Skip to content

Web APIs: labs

James Crowley edited this page Jul 17, 2019 · 11 revisions

Web APIs: Labs

Welcome to the Web APIs lab! This lab is pretty open-ended because we want to see what APIs you can discover and use. You can work in pairs or larger groups. Here's a bunch of things you might want to try. Choose one and make it awesome - or come up with your own idea :)

Don't forget to create a GitHub repo for your project, and check in regularly!

Exercises

Weatherbot!

  • Create a twitter bot using tweepy
  • Every hour, it should check and tweet the weather using emojis
  • You'll need a Twitter developer account which you can get from https://developer.twitter.com/. Say you're "exploring the API" and taking a class on Web API's.

I'm taking a class about chatbots. we're learning how to use web apis and ifttt to build a weather bot that tweets the weather in the city you're in. we're learning about rate limiting so we're careful not to spam anyone! More info about our labs are here: https://github.com/glblcd/material/wiki/Web-APIs%3A-labs

I'm building a bot to use a weather API and then every hour it will tweet what the weather is like in my home town

Distancebot!

  • Use GeoPy to build an app which takes any two cities and calculates the distance between them.

Slack!

  • Use the Slack API to build an app which posts to a channel in the GlobalCode Slack!
  • Go to api.slack.com and create an app. When prompted, sign in with the globalcode.slack.com workspace
  • Click through the prompts until you get to the bit about features. Enable a bot feature and give it a fun name
  • Finish creating the app and make note of the tokens. You'll need these to connect to the API
  • Head to the docs and learn how to get started.

Rock on!

  • Use the LastFM API to tell a person about their favourite artist.

What's going on?

Country data

  • Use the World Bank API to find out how much money different countries spend on, say, university students ;-)

Cheer up!

  • Use the tweety API and the FacePlusPlus face detection API to check a user's profile picture and tell them to cheer up if they're not smiling 👍

Roll your own:

For the rest of the day, we want you to work in small groups (maybe double up your pairs) to build an application that does something interesting using the programmable web.

Look at the APIs available on MashApe to help you get started.

If you want to send an SMS, create an account on Twilio and let me know your email address.

Don't rush - spend some time looking at the options available to you. You might need to sign up for a free or trial account, that's cool.

Try to choose something that's personally interesting to your group, because that way you'll stay motivated.

Make sure you use your knowledge of git and python modules, so you can split up the project into tasks and all work at once.