DEV Community

Cover image for REST APIs & HTTP Requests

REST APIs & HTTP Requests

Connor Dillon
Full-stack Javascript developer, fire dancer, physics nerd, Vim fanboy, and technical writer! I'm passionate about my work and love to talk shop, so say hi!
・1 min read

What is an API?

  • API stands for "Application Programming Interface"
  • Contract provided by one piece of software to another
  • Structured request and response

What is REST?

  • REST stands for "Representational State Transfer"
  • Architectural style for designing networked applications
  • Relies on a stateless, client-server protocol, almost always HTTP
  • Treats server objects as resources that can be created or destroyed
  • Can be used by virtually any programming language
  • All APIs have their own rules and structure

Types of Requests

  • GET: Retrieve data from a specified resource
  • POST: Submit data to be process to a specified resource
  • PUT: Update a specified resource
  • DELETE: Delete a specified resource
  • HEAD: Same as get but does not return a body (only returns header)
  • OPTIONS: Returns the supported HTTP methods
  • PATCH: Update partial resources (similar to PUT)

API Endpoints

Endpoints are URLs that you can access to do certain things:

Method URL Function
GET Get all users
GET Get single user
POST Add user
PUT Update user
DELETE Delete user

Discussion (0)