dcsimg
www.webdeveloper.com
Results 1 to 10 of 10

Thread: What is REST API?

  1. #1
    Join Date
    Aug 2017
    Posts
    7

    Question What is REST API?

    I am currently applying for jobs, and I see this more and more:
    "integrating or building front-end client applications with REST APIs. "

    What does that even mean? I looked up the tutorial video on the restapitutorial website, and it in no way explains what this is. They expect you to know what the heck they're talking about.
    • Is it a philosophy, an actual software using and/or integrating api keys?
    • Beyond what it is, what does it do?

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    22,147
    It's basically (and this is over-simplification) a combination of a defined structure to the URI's used to access your API along with the use of different HTTP request methods to define what the server will do with a given request.

    "www.example.com/users/123", if used via a GET request, may return data on user ID 123. If instead it is accessed via a POST request, the application will look for additional request data which it will use to create a new user with ID 123. A PUT request will replace user 123 with the provided data, or create it if it doesn't exist, whereas a PATCH request would only attempt to update an existing resource. A DELETE request, will -- surprise -- delete user 123.

    Possibly a clearer example: https://en.wikipedia.org/wiki/Repres...d_HTTP_methods
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #3
    Join Date
    Aug 2017
    Posts
    7
    Thanks. So, it's basically just a way telling the browser how to process the request via your code. No libraries and no added code (except for the one that'll already be in place).

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    22,147
    Kind of the reverse: requests from the client (which could be a browser or another web app) tell the server what they want it to do, based on the URI structure and the HTTP method used for the request. The server side code then needs to be written to recognize requests based on their format/content along with the HTTP request type, and do the appropriate things. The implementation details that do the "routing" of requests to actions are often encapsulated within framework code or library classes/objects, etc., depending on the server-side language and framework (if any) being used.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  5. #5
    Join Date
    Aug 2017
    Posts
    7
    I see. So, if I understand correctly: the browser asks the server side language (like PHP for example) to do the right action. And then, a framework like Laravel could be used in the process as well, in terms of possessing the details to do the "routing" etc. But, if there is no framework, then PHP would do the work that was coded.

  6. #6
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    22,147
    Or just think of it as a specification for a standardized way to make web API requests. The web service will be designed to recognize certain URI formats in combination with different HTTP method types. Any request that matches one of those URI format/method combinations will be routed by the server-side code to the applicable method/function/whatever. That web app will then need to publish its API in terms of what URIs and HTTP methods are used to do what.

    So if creating a RESTful server-side API, you need to know how to set it up and define it in terms of whatever server-side language/framework you are using. If you are instead writing code to use a RESTful API, you need to know how to create and send appropriate HTTP URIs/methods and then consume the responses, e.g. via JavaScript AJAX requests in a dynamic web page (using jQuery, Angular, whatever the hot JS thing is to use where you work ), or perhaps via cURL requests in another server-side application that needs to use that other system's API.

    Or...keep searching for tutorials, because I'm probably doing a lousy job of trying to describe it in 100 words or less.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  7. #7
    Join Date
    Aug 2017
    Posts
    7
    I think I understand what you were saying above, minus was an URI is. I do know that you're doing a better job than the tutorial website I looked at, that's for sure.

  8. #8
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    22,147
    URI is essentially the same as URL (URL is really a sub-set of URI [I think]). So "https://www.example.com/reviews/books/12345?filter=scifi" would be a URI.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  9. #9
    Join Date
    Aug 2017
    Posts
    7
    Well in that case, great!

  10. #10
    Join Date
    Jul 2017
    Location
    C-11,OKHLA VIHAR, JAMIA NAGAR, NEW DELHI-110025
    Posts
    21
    What is REST? REST stands for Representational State Transfer. (It is sometimes spelled "ReST".) It relies on a stateless, client-server, cacheable communications protocol -- and in virtually all cases, the HTTP protocol is used.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles