From the course: Learning REST APIs

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

REST and Authorization/Authentication

REST and Authorization/Authentication

From the course: Learning REST APIs

Start my 1-month free trial

REST and Authorization/Authentication

- The response you get from a REST API depends on the authorization level you have when you make the request. Most REST APIs provide leveled access meaning all users can submit limited GET, HEAD, and OPTIONS requests. Some users can submit POST requests and a rare few users can submit PUT, PATCH, and DELETE requests. To get a quick view of this we can send two HEAD requests to the same resource. First, an unauthenticated request. For this unauthenticated request the allow header down here on line 10 says, Allow: GET, meaning anyone can send a GET request to this resource but nothing else. Now let's see what happens if I add an authorization header to my requests. To do so I'll go back to my request, type in Authorization: and then say this is basic authorization and provide my user name and my password. Just before I continue, the local WordPress site I'm working with is set up with Basic authentication which is extremely insecure. You can see I'm passing the username password in…

Contents