Catmandu::Store::REST - Store/retrieve items from a JSON REST-API endpoint
# From the command line $ catmandu export REST --id 1234 --base_url https://www.example.org/api/v1/books --query_string /page/1 to YAML # From a Catmandu Fix lookup_in_store( book_id, REST, base_url: https://www.example.org/api/v1/books, query_string: /page/1 )
# From a Catmandu Fix lookup_in_store( book_id, REST, base_url: https://www.example.org/api/v1/books, query_string: /page/1 )
Uses a RESTful API as a Catmandu::Store.
The module allows you to use a RESTful API that uses JSON as data format and uses the URL format [base_url]/[id][query_string] as a Store for Catmandu.
[base_url]/[id][query_string]
Retrieving (GET), adding (POST), updating (PUT) and deleting (DELETE) single items is supported. Data must be provided as JSON by the API, and the API must accept JSON for PUT/POST requests. The URL must be of the format [base_url]/[id][query_string], where the id is absent for POST requests.
GET
POST
PUT
DELETE
id
You must provide the base_url parameter.
base_url
base url of the API endpoint (the entire url before the ID) (e.g. https://www.example.org/api/v1/books).
query_string
an optional query string that comes behind the ID (e.g. /page/1 where the complete URL is https://www.example.org/api/v1/books/1/page/1).
Pieter De Praetere <pieter@packed.be>
Copyright 2017- PACKED vzw
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Catmandu::Store::REST, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catmandu::Store::REST
CPAN shell
perl -MCPAN -e shell install Catmandu::Store::REST
For more information on module installation, please visit the detailed CPAN module installation guide.