http://qs321.pair.com?node_id=11123299


in reply to Good REST API Tutorial for Perl.

What I understand as of now, is that REST API is something like a call I make to a website and give me the results in the json format, that's all.

Not quite. Firstly, there is no requirement for REST to use JSON although many instances do. Secondly, REST is more specific in that it stipulates the creation, deletion and modification of data items via a structured path. The HTTP methods are respected as are HTTP status codes - REST therefore necessarily builds on HTTP. There is plenty of detailed documentation on the web about what REST is and what it isn't (eg https://en.wikipedia.org/wiki/Representational_state_transfer#Architectural_constraints).

If you could direct me to a good tutorial that teaches REST API using Perl, I will be ever so thankful.

Do you want to build a client or a server?


🦛

Replies are listed 'Best First'.
Re^2: Good REST API Tutorial for Perl.
by netizen (Novice) on Oct 30, 2020 at 00:25 UTC

    Hi Hippo,

    Thanks for the clarity. In my case, the Server is already there. Its device that has REST APIs available. I need to build something that will "connect" to it and get the output.

      REST::Client will get you started.

      There are many more clients for specialized REST services - if you are using a well-known REST server, you will be better off using a pre-written specialized client.

      Here is a brief Rest::Client tutorial.

                      "Imaginary friends are a sign of a mental disorder if they cause distress, including antisocial behavior. Religion frequently meets that description"

        I recommend HTTP::Tiny. A client need not be over complicated and it's a good exercise for someone learning the nuances of interfacing with a RESTful API.
Re^2: Good REST API Tutorial for Perl.
by programmingzeal (Beadle) on Feb 15, 2022 at 16:48 UTC
    Hi hippo, I want to build a REST server using Perl. How can I do this? Please point some tutorial and CPAN APIs. Thanks