Slide 1

Slide 1 text

Introduction to REST APIs Deeper understanding about REST APIs

Slide 2

Slide 2 text

Clifford Ouma @clifford_ouma Who I am Postman Student Leader Moi University Clifford Ouma

Slide 3

Slide 3 text

Agenda go.postman.co/build Recap intro to APIs? 1. Introduction to RESTful APIs 2. Building RESTful requests 3. Working with responses 4. Demo using HTTP requests 5. Conclusion 6.

Slide 4

Slide 4 text

What’s an API?

Slide 5

Slide 5 text

API? Application Programming Interface A P I

Slide 6

Slide 6 text

Interface I Allow control of interaction with obstruction

Slide 7

Slide 7 text

Interface I Allow control of interaction with obstruction UI is for users while API is for programmer

Slide 8

Slide 8 text

Interface I Allow control of interaction with obstruction UI is for users while API is for programmer Allows programmer interact with data without worrying about implementation

Slide 9

Slide 9 text

APIs Client Server

Slide 10

Slide 10 text

There’s an API for everything Everything The Cat API OpenWeatherMap Twilio Discord Youtube-to-MP3 Spotify Twitter Facebook Google And so many more!

Slide 11

Slide 11 text

More than 500,000 organizations & 13 Million developers use Postman 98% of Fortune 500 Organizations use Postman 65% of Global 2000 Organizations use Postman Postman is a collaborative API development platform that simplifies creating, using, and testing APIs with a UI What is Postman?

Slide 12

Slide 12 text

Working APIs: Then and Now cURL Command Line Postman

Slide 13

Slide 13 text

Let's talk about REST APIs

Slide 14

Slide 14 text

Introduction to REST APIs R E S T State Representational Transfer

Slide 15

Slide 15 text

Introduction to REST APIs REST defined a clear way of working with Web APIs

Slide 16

Slide 16 text

Introduction to REST APIs REST defined a clear way of working with Web APIs APIs that use REST architecture are called RESTful APIs

Slide 17

Slide 17 text

Requests and Responses

Slide 18

Slide 18 text

Request-Response Pattern Client Server Request Response Resources Services Network API

Slide 19

Slide 19 text

Making Requests Method (GET, POST, etc) Address/Endpoint (URL) Path The three ingredients to make a request: How we interact with the API

Slide 20

Slide 20 text

Requests - Methods and Endpoints Method GET Retrieve information POST Send information PUT/PATCH Update information DELETE Delete information Bare minimum for a request

Slide 21

Slide 21 text

Requests - Methods and Endpoints Method GET Retrieve information POST Send information PUT/PATCH Update information DELETE Delete information address of the server Bare minimum for a request https://www.google.com/search The scheme of the request. Defines how to communicate Host Path Protocol destination where request can be heard and executed

Slide 22

Slide 22 text

Specifying Detail Parameters Start with ? and have key and value Query params and search params Building your requests

Slide 23

Slide 23 text

Specifying Detail Parameters Start with ? and have key and value Query params and search params Authorization Building your requests

Slide 24

Slide 24 text

Specifying Detail Parameters Start with ? and have key and value Query params and search params Authorization Headers and body Provides metadata and more info Building your requests

Slide 25

Slide 25 text

Requests - Body The data payload Optional, but often supplied with POST and PUT requests Data types form data JSON text HTML XML files GraphQL … and more! { “name”: “Jane Doe”, “email”: “[email protected]”, “birthYear”: 1970 } JSON

Slide 26

Slide 26 text

Receiving Responses Status codes (200 OK, 201 Created, 404 Not found) Headers Accessing body data Response elements

Slide 27

Slide 27 text

Status Codes

Slide 28

Slide 28 text

Receiving Responses They explain what happened on the server side 2xx (Success): e.g 200(Ok) 3xx (Redirection) e.g 301(Moved) 4xx (Client Error) e.g 404 (Not found) 5xx (Server Error) e.g 500(Internal Error) Status Codes Examples:

Slide 29

Slide 29 text

How does all of that fit with REST?

Slide 30

Slide 30 text

Why REST APIs are popular Simple and standardized Easy to understand & industry standard 1.

Slide 31

Slide 31 text

Why REST APIs are popular Simple and standardized Easy to understand & industry standard Scalable and Stateless Modifications & no worry on about state 1. 2.

Slide 32

Slide 32 text

Why REST APIs are popular Simple and standardized Easy to understand & industry standard Scalable and Stateless Modifications & no worry on about state High performance/Caching Reduced number of requests 1. 2. 3.

Slide 33

Slide 33 text

CRUD in REST CRUD HTTP METHODS CREATE POST READ GET UPDATE PUT/PATCH DELETE DELETE

Slide 34

Slide 34 text

Demo TIme

Slide 35

Slide 35 text

Recap

Slide 36

Slide 36 text

Continue Learning APIs as a Student Expert Student Expert certification indicates that you are proficient in the essential skills involved in building and testing API requests in Postman, including: Sending more sophisticated requests in Postman. Editing documentation for a collection. Writing basic test scripts. Running collections, passing data between requests, and scripting request execution order. Have the option to become a Student Leader in your community

Slide 37

Slide 37 text

Postman Student Expert Apply here: https://bit.ly/postman-student-program

Slide 38

Slide 38 text

Resources learning.postman.com Learning Center explore.postman.com API Network community.postman.com Forum

Slide 39

Slide 39 text

Q&A

Slide 40

Slide 40 text

Feedback form https://bit.ly/REST-feedback