APIs and Webhooks
APIs and Webhooks
Big Idea
-
We want our device to interact with services all over the internet–e.g. permanently store all heart rate data in the cloud, retrieve the weather forecast tomorrow, etc.
-
APIs provide the mechanism we use to communicate with these other services
-
Webhooks are created in the Particle cloud to connect our to an API online
APIs (Application Programming Interface)
- A specification used as an interface between different pieces of software
- Allows code we write to connect to other services, gather data, etc.
- Usually related to a software library
- May also be related to a software framework
- May also be an implementation of a protocol
Examples of APIs
- Weather data - https://weatherstack.com
- Dictionaries - Merriam-Webste
- Transit data - Bay Area Rapid Transit
- Useful lists of public APIs
- Publishing APIs on the internet has created an open architecture for sharing content and data
General Process to Interacting with API Data
- Identify API you want to use (make account if necessary)
- Create a Particle webhook that interacts with the API
- A webhook is trigger we create at the Particle Cloud
- When we send data to a webhook, it causes the Particle Cloud to perform an action we defined
- Note: this describe sending data only. We will discuss later in the semester how to receive data
##
##
##
Creating a Webhook
Go to Particle Cloud Console Integrations > Webhook