Problem Solving with Algorithms

반응형

RESTful API 설계 : 개발자가 선호하는 RESTful Developer-Friendly API로 웹 서버를 구축하고 보호하세요.

 

Designing RESTful APIs

classroom.udacity.com/courses/ud388

 

www.youtube.com/watch?v=wrKjdclSXGU&list=PLDyq9ipnszcgxFKdsATyBSTctO9tYoJPi

 

Prerequisite

Want to brush up on your Python, Flask, and SQLAlchemy skills?

Go ahead and check out Full Stack Foundations to make sure you have an understanding of the python topics used in this course.

=> inner-game.tistory.com/511

 

Documentation for Flask and SQLAlchemy can be found here as well.

 

The Authentication and Authorization will come in handy when we cover API Security.

=> inner-game.tistory.com/512

 

Checkout these instructions for configuring the Vagrant machine for this course.

You will also need Google Developer and Foursquare Developer accounts for this course.


LESSON 1: What's and Why's of APIs

Discover the foundation of Web APIs, the common systems for passing and updating information to web applications.

 


 

Learn more about the OSI Model.

 

 

Update: While SOAP is still used in some contexts, RESTful APIs currently dominate the API landscape. It is no longer an 'up and coming' technology, but rather simply the best practice for API development.

NEXT

 

View Thomas Fielding's dissertation on REST.

NEXT

 


LESSON 2 : Accessing Published APIs

Practice gathering and reading information from web APIs that already live on the internet.


 

Check out the official cURL documentation and this blog post for getting started with cURL.

Check out the Postman Documentation as well.

You should also be familiar with query strings as option to pass in variables straight from the URI.

NEXT

 

 

Errata:

As of December 2017, SoundCloud is no longer accepting new API sign-ups.

NEXT

 

 

Google Maps API

First, get your Google Maps API key

Then use the Google Maps Geocoding API.

 

 

Here's the Foursquare API.

You may have realized that Foursquare has a geolocating capability as well, but since you already learned how to use the google maps one, you might as well put it to good use ;-)

You can copy and paste the coordinates below: Mountain View, California (37.392971, -122.076044)
Miami, Florida (25.773822, -80.237947)
Washington, DC (38.897478, -77.000147)
New York, New York (40.768349, -73.96575)

NEXT

 

 

Check out the geocode.py file from this activity.

NEXT

 

 

Download the starter code for this exercise.

View the solution code for this exercise.

 

 

Some Interesting APIs to Explore

 


LESSON 3 : Creating your own API Endpoints

Begin creating your own API endpoints and learn to serialize your data to package it up for transfer across the web using HTTP.


 

 

http://flask.pocoo.org/docs/1.0/tutorial/

 

 

Click to view the Flask Quickstart Documentation.

NEXT

 

View the Starter Code here.

Correction in video: In line 7, rename the function to puppiesFunction() and in line 13 rename the function to puppiesFunctionId(id). CORRECTION: The second function name here will be puppiesFunctionId(id)

View the solution code here.

NEXT

 

 

View the starter code here.

View the solution code here.

 

View the starter code for this exercise.

View the solution code for this exercise.

Errata:

The code in the starter and solution files in the Github repo has been updated slightly from the code in the video. For instance, the correct route for puppiesFunction is "/puppies" (with no slash), not "/puppies/". When in doubt, refer to the code and the tests for it.

 

 

View the starter code for this exercise.

View the solution code for this exercise.

 

 

 

 


LESSON 4 : Securing your API

Control access to your APIs by limiting who can access the resources behind them and ensuring that only authorized users can read and modify data.

 


 

View the code from this exercise here.

Note:

The API for passlib is changing. Instead of using .encrypt(), that function has been replaced with .hash() If you're trying to find the documentation for .encrypt(), look for the documentation for .hash() instead: http://passlib.readthedocs.io/en/stable/lib/passlib.ifc.html#passlib.ifc.PasswordHash.hash

NEXT

 

 

At the end of the video, Lorenzo recommends performing secure login over HTTPS. For more about HTTPS (HTTP over TLS encryption), see these courses —

You can find the code for this video here.

NEXT

 

 

 

View the code for this video here.


Errata:

The API for the Flask HTTP Basic Authentication library has changed since this course was created. The module has been renamed from flask.ext.httpauth to flask_httpauth. Today, the recommended import statement is as follows:

from flask_httpauth import HTTPBasicAuth

The older module name will still work, but will give you a warning message.

See examples in the flask_httpauth documentation.

NEXT

 

View the starter code for this activity here.

View the solution code for this activity.

 

View the code for this activity here.

NEXT

 

The starter code for this activity is available here.

View the solution code for this activity.

 

 

The code for this activity is available here.

NEXT

 

View the starter code for this activity here.

You'll need to replace the client_id on line 14 of clientOAuth.htmlwith your own Google client ID.

View the solution code to this exercise here.

 

View the code from this exercise here.

NEXT

 

The starter code for this exercise can be viewed here.

Additional Note

It is best to have two terminals open that are logged into the Vagrant VM. In the first one, start the Redis server with this command:

redis-server &

Then press the return key to get back to the command prompt (the "&" character allows this to happen). Then run the views.py Python script, like this:

python views.py

Now move to the 2nd Vagrant terminal and run the hungry client script. Both the Flask backend (views.py) and the Redis server must be running for this to work properly.

View the Solution Code for this exercise.

 

 


LESSON 5 : Writing Developer-Friendly APIs

Customize your APIs to be usable and approachable by the developers who will consume them.


Errata

The Udacity Catalog API documentation has been moved from the web page shown in this video to this file.

 

I tend to use URL and URI interchangeably in this course, but there is a subtle difference between the two acronyms. Check out this article if you are interested in learning more about the differences and similarities between URLs and URIs.

NEXT

반응형
반응형

공유하기

facebook twitter kakaoTalk kakaostory naver band