The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Catmandu::Store::REST - Store/retrieve items from a JSON REST-API endpoint

SYNOPSIS

  # 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
  )

DESCRIPTION

  # 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.

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.

PARAMETERS

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).

AUTHOR

Pieter De Praetere <pieter@packed.be>

COPYRIGHT

Copyright 2017- PACKED vzw

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO