Skip to content

Instantly share code, notes, and snippets.

@vjrngn
Last active June 3, 2018 09:59
Show Gist options
  • Save vjrngn/ef31cc969b66d6c80f149d2b8484c79e to your computer and use it in GitHub Desktop.
Save vjrngn/ef31cc969b66d6c80f149d2b8484c79e to your computer and use it in GitHub Desktop.
REST assignment

Day 2

HTML & CSS

  • HTML - Hyper Text Markup Language
  • CSS - Cascading Style Sheets

REST

  • REpresentational State Transfer

  • Architectural pattern for developing HTTP APIs.

  • REST provides a standardized way to interact with HTTP based APIs.

  • A REST url (or endpoint) takes the following shape (or form):

      http(s)://domain_name/{resource}

    Let's break this down:

    • http(s):// indicates the protocol
    • domain_name is the domain (for example facebook.com) on which the resource exists.
    • resource is the thing that the API exposes. For example, in https://facebook.com/users, users is the resource.
  • Convention

    • GET a listing of a resource.

        GET {domain_name}/{resource}

      This will give us the list of users

        GET https://facebook.com/users
    • POST - Create a new resource. POST is used to create a new entry.

        {domain_name}/{resource}

      This will create a new user

        POST https://facebook.com/users
    • GET a specific resource.

        {domain_name}/{resource}/{resource_id}

      Ex: This will give us details about a single user with ID 1

        GET https://facebook.com/users/1
    • PUT edits a resource. PUT is used to modify / update the details of a specific resource

      PUT http(s)://{domain_name}/{resource}/{resource_id}

    Ex: This will update the details of the user with ID 1

      PUT http(s)://facebook.com/users/1`
  • Nested resources - A nested resource is something like posts and comments. A post can have many comments (think Facebook). We follow the following convention for nested resources:

  http(s)://{domain_name}/{resource}/{resource_id}/{sub_resource}

Ex: This will give us all the comments that are under posts with ID 1

  http(s)://facebook.com/posts/1/comments

Write the HTTP Method and URL for getting a list of posts from facebook.

  // TODO

Write the HTTP Method and URL for fetching details of single post

  // TODO
  • GET all comments for a specific post
  // TODO
  • POST a new comment for a post
  // TODO
  • GET a specific comment for a post
  // TODO

Bash commands and Bash scripting

  • Original scripting shell was called Bourne Shell (sh), created by Stephen Bourne
  • Bash is an improvement over sh - Bourne Again
  • Bash is used to run commands on the terminal / command line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment