consume content on multiple devices, each device offers a different experience of the same content. • Programmatically access data: Using the API documentation, application developers can derive the URL that they need to request in order to get the data they want.
To access a resource, the client sends an HTTP request to the host (server that maintains the resource), specifying the URL of the resource and the operation on that resource. • The “verbs” built into the http protocol (GET, POST, PUT, and DELETE) map directly to application-level operations for retrieving, creating, modifying, and deleting data.
are using the HTTPS protocol, which is a secure version of HTTP • host (api.github.com): A host is usually a domain name, but it could also be an IP Address. • path (/search/repositories): Everything from the first / up to the ? that starts the query string is the path. When making API calls, these paths map to the API method that is being called. • parameters: key-value pairs of the form <key>=<value>, starting with a question mark (?) and separated by an ampersand (&).
KNOW: • Which application is making the request • Which user the request is posting on behalf of • Whether the user has granted the application authorization to post on the user’s behalf
at the needs of APIs and API developers • Now the de facto standard for API authentication • Motivated by a need for users to approve an application to access a service (i.e. Twitter, Instagram, Meetup) on their behalf, without requiring them to share their password
to use ACoolAPI, you register your app with the ACoolAPI service, which then assigns the FOO client a client_id and client_secret. • FOO can use the client_secret to verify it is sending API requests as FOO, not as SOME_EVIL_APP pretending to be FOO.
of a user, FOO presents its client ID to the service in order to acquire an access token. FOO also specifies an Authorization callback URL that the user should be redirected to after s/he authorizes FOO to access ACoolAPI on his/her behalf. • After the user authorizes FOO to access ACoolAPI on their behalf, they're redirected to a URL that includes an auth code for FOO developers to exchange for an access token. • The app developer POSTs this code, along with some app identification parameters (client_id, client_secret), to the service's access_token endpoint.
provided by the service and and provides redirect_uri = http:// myexamplewebapp.com/oauth_page • A successful authentication will redirect the user to http:// myexamplewebapp.com/oauth_page?code=BAR • Developers of the FOO client pass the auth code BAR to request the /oauth/access_token endpoint of ACoolAPI. The service responds with an OAuth access token, which allows FOO to use the service on the user's behalf.
registered app by checking it in on a public Github repo. • If you're building an app that does not have a server component (apps that have the entire source code available to the browser), then you cannot keep the client secret confidential and must use an auth flow that does not require a client secret. OAuth 2.0 specs a different authentication flow for this case.
Literal notation, but there are differences between them. For example, in JSON all keys must be quoted. • Most JSON documents are one big object, but they can also be one big array: [ "This", "Is", { "valid": JSON } ]
quotes, while in JavaScript, you can use single or double quotes interchangeably • number: in JavaScript you can use Hexadecimal Literals or Octal Literals. In JSON you can use only Decimal Literals. • object: documents can be nested in other documents • array • boolean: true, false • literal: null
FEATURES SUCH AS: • Caching: if it successfully makes a request, httplib2 will store the response temporarily so the next time the same request is made, it can fetch the response without going over the network • Compression: when the HTTP client requests a resource, it can ask the server to send it in compressed format to reduce the amount of data sent over the network. By reducing the size of data sent over the network, more bandwidth is available and transmission times are reduced.