Forum Discussion

Gt_Clen's avatar
Gt_Clen
New Contributor
3 years ago
Solved

What are the things to know about restful api?

just wanted to discuss on rest api, rest is all about http requests right and data is sent in form of json and the api routes are added logic with controllers and then we can basically see the response in network tabs of chrome dev tools like http status codes and responses, also there are http verbs for put,get,post,delete,patch

And like different status codes of http responses suggest different modes of response, success(200),error(404),server error(500) etc

All these consists of restful api right? Are there more aspects on restful api?

Thanks

  • Hey Gt_Clen,

    Your question could take hours to answer and even then youd be scratching the surface. There are many aspects to REST/HTTP and it just depends on what areas youre thinking about. Just thinking about poking an endpoint via a REST request just barely touches the surface of the subject.

    In response to your comments:

    HTTP requests are not necessarily RESTful. e.g. you might look at an HTTP request and think it's a REST request, but in fact its RPC, not REST.

    REST is an architectural design approach that the internet/web is based upon.

    REST currently supports both json and xml, but you can also use REST to publish many other file attachment types not just json, xml.

    REST supports all the differenr http methods/verbs, not just the CRUD related ones you mention (POST,PUT,PATCH,DELETE, GET). Quick google indicates theres actually currently 39! Never actually used ny of the others, but they are available, although i dont see much testing of a HEAD method when a GET does the same thint, but retrieves more info.

    REST uses HTTP/HTTPS so it's this that determines the fact you get HTTP status response codes (2xx series = success responses, 3xx series = redirects related, 4xx series = client errors, 5xx series = server errors)

    If i wanted to learn more about REST, Id read up on HTTP rather than REST initially as it uses HTTP/HTTPS and so a lot of the behaviours youve mentioned or will come across are actually HTTP, rather than REST.

    as i said above its a broad subject. If you consider the UI of ReadyAPI! for example and look at the differenr functionalities, that might help guide your reading. I.e. authentication. Huge subject, ReadyAPI! supports various different. authentication/authorisation schemes that can be used by HTTP/REST, dffferemt parameter types for REST requests, different mediatypes - i.e. application/json, x-www-form-urlencoded, multipart/form-data, %/URL encoding, etc., etc.

     

    Im assuming youre asking for work so i suppose it does actually make a good starting point to look at hte functionality youd be using in your job and then read about the supporting theory that relates to that functionality.

     

    hope this helps!

     

    nice one,

     

    Rich

1 Reply

  • richie's avatar
    richie
    Community Hero

    Hey Gt_Clen,

    Your question could take hours to answer and even then youd be scratching the surface. There are many aspects to REST/HTTP and it just depends on what areas youre thinking about. Just thinking about poking an endpoint via a REST request just barely touches the surface of the subject.

    In response to your comments:

    HTTP requests are not necessarily RESTful. e.g. you might look at an HTTP request and think it's a REST request, but in fact its RPC, not REST.

    REST is an architectural design approach that the internet/web is based upon.

    REST currently supports both json and xml, but you can also use REST to publish many other file attachment types not just json, xml.

    REST supports all the differenr http methods/verbs, not just the CRUD related ones you mention (POST,PUT,PATCH,DELETE, GET). Quick google indicates theres actually currently 39! Never actually used ny of the others, but they are available, although i dont see much testing of a HEAD method when a GET does the same thint, but retrieves more info.

    REST uses HTTP/HTTPS so it's this that determines the fact you get HTTP status response codes (2xx series = success responses, 3xx series = redirects related, 4xx series = client errors, 5xx series = server errors)

    If i wanted to learn more about REST, Id read up on HTTP rather than REST initially as it uses HTTP/HTTPS and so a lot of the behaviours youve mentioned or will come across are actually HTTP, rather than REST.

    as i said above its a broad subject. If you consider the UI of ReadyAPI! for example and look at the differenr functionalities, that might help guide your reading. I.e. authentication. Huge subject, ReadyAPI! supports various different. authentication/authorisation schemes that can be used by HTTP/REST, dffferemt parameter types for REST requests, different mediatypes - i.e. application/json, x-www-form-urlencoded, multipart/form-data, %/URL encoding, etc., etc.

     

    Im assuming youre asking for work so i suppose it does actually make a good starting point to look at hte functionality youd be using in your job and then read about the supporting theory that relates to that functionality.

     

    hope this helps!

     

    nice one,

     

    Rich