Restful api confusion


I am seeing ads asking for RESTful api familiarity. Would the json api challenges on FCC be considered RESTful apis? Correct me if I am wrong, but I think that answer would be no. I think that RESTful api familiarity would mean I am creating an api documentation for developers to use my app I have already devloped? Anyone know if this is correct, if not, can you please clarify?


Yes, this would be a type of REST API


Thank you @jecousa !
First I read this…

and then it linked to this and I got confused…


Yeah it is confusing, but essentially they are methods (actions) used to request data. Fortunately, I just learned about them in class was week! :slight_smile:


As I think you should read this articles on tutorialspoint web site. It clearly explains about RESTful api.


The json api challenges do not use rest apis - those exercises are a very basic introduction to retrieving json data from a server using XMLHttpRequest - url paths are used for sure e.g. /json/cats.json - this in itself does not make the url an api endpoint let alone restful

You are right to answer no - apis are for progammatic access to services - generally an api comprises many url endpoints meant to be used together by an application to solve a problem - the twitch api mentioned in this exercise is an example of a rest api

but the wikipedia search api mentioned in this exercise is not restful

Also familiarity with rest apis suggests extensive use of rest apis and possibly experience designing and implementing rest apis


You’re right, I did not see OP was asking about JSON exercises, I was thinking the projects themselves, which do use REST.


Is the weather api challenge considered rest?


What class are you in? Bootcamp or University?


The weather api in is not restful


I am taking and Android Enterprise class at University


But the twitch api is rest you said earlier. I found the weather and the twitch to be very much the same…what is the difference that makes one restful and not the other?


Why do you say the weather api is very much the same as the twitch api? It’s better to have specific questions to answer or at least points to counter - is it that both use a URL to access info from a server? Any other similarity?

the weather api seems to be just a single endpoint like - there is no real api design here - it is again just a url that lets you access some data once

the twitch api comprises many endpoints organized around resources like channels, games, users etc - it uses http methods in a restful way - an application using this api can solve problems through navigation of representations of these resources returned by the apis


I would say the same to you, OP asked about why these aren’t considered RESTFUL, but you didn’t really answer why. Could you please elaborate why these are not considered RESTFUL?


I just provides you a json blob, what you do with it is up to you.


Ok, I understand, thanks


Well - I have outlined above why the twitch api is restful - the absence of those aspects from the weather api is what makes it non-restful - key restful aspects are resources, representations and state transfer, and operations distinguished by the use of http methods as verbs

just because a url is used with http and some json data is returned does not make it an api or restful - an api needs considerable thought and design so it can be used by programmers to solve a specific set of problems - restful is a particular philosophy of how to design an api

wikipedia is a good place to start to get a handle on these terms - they are not easy to understand maybe even impossible without actually designing a restful api


Is what you are saying that these projects are neither RESFTFUL or not, it comes down to how they are implemented?


Of the applications the projects use, one has been architected to have an API that works in a more RESTful way than the other. The actual frontend projects are neither RESTful nor not RESTful. I think one of the backend API projects is, sort of. REST is just a way of architecting the way clients access things on a server, using a small set of specific rules.