Skip to content

Latest commit

 

History

History
53 lines (31 loc) · 2.15 KB

File metadata and controls

53 lines (31 loc) · 2.15 KB

SB Hacks VII API Requests Collection

Workshop date: January 16th, 2020 @ 3pm PST
Hosted by: Jayleen Li and Daniel Guo from SB Hacks

This repo is meant to serve as a easy plug-n-play for API requests in popular hackathon languages like Python, JavaScript, and Node.js. Take the examples you see and copy paste them as you see fit!

Workshop description: Join SB Hacks for a introductory workshop on APIs and what they are, as well how to incorporate them into your hackathon projects quickly! Although there are so many ways to incorporate APIs, in the workshop we will show how call the Yelp API in a Flask app and a non authorized API in a pure front end (HTML/CSS/JavaScript) project.

This workshop is intended for those with some coding knowledge and some understanding of basic web development.

Link to Workshop Slides Link to Recording (will be available after the workshop!)

How to run the examples

Node.js

cd into the folder where the file is and do this in your terminal: You may need to npm install axios

node node-js-req.js

JavaScript

Open 'index.html' file in the browser of your choice. You can do this by right-clicking on the file and clicking "Open with" Open with browser

You should see your code in the browser now. Right-click and click "Inspect". Then click the "Console" tab in the dev tools. This screenshot is in a chrome browser, and may look different for other browsers. You should see something like this

Python

cd into the folder where the file is and do this in your terminal: You may need to pip install requests

python python-req.py

How to run the Demos

Flask Demo

cd into the folder where the file is and do this in your terminal: You may need to pip install requests and pip install flask

export FLASK_APP=app.py
flask run

HTML/CSS/JavaScript Demo

Open it the same way you would open the JavaScript request-example.