DEV Community

Cover image for REST APIs & HTTP Requests
Connor Dillon
Connor Dillon

Posted on

2

REST APIs & HTTP Requests

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 https://website.com/api/users Get all users
GET https://website.com/api/users/1 Get single user
POST https://website.com/api/users Add user
PUT https://website.com/api/users/1 Update user
DELETE https://website.com/api/users/1 Delete user

API Trace View

How I Cut 22.3 Seconds Off an API Call with Sentry

Struggling with slow API calls? Dan Mindru walks through how he used Sentry's new Trace View feature to shave off 22.3 seconds from an API call.

Get a practical walkthrough of how to identify bottlenecks, split tasks into multiple parallel tasks, identify slow AI model calls, and more.

Read more →

Top comments (0)

Bump.sh

Hate writing docs?

Hate undocumented APIs even more?

Bump.sh generates an always up-to-date API reference site for REST and Event-Driven Architectures.

Plug it in your CI. It fetches your OpenAPI and AsyncAPI (GraphQL pending) spec files, and even generates a diff. Gather all of your API docs in a single source of truth.

Try it for free

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay