Skip to main content

Notice

We are in the process of rolling out a soft launch of the RDA website, which includes a new member platform. Existing RDA members PLEASE REACTIVATE YOUR ACCOUNT using this link: https://rda-login.wicketcloud.com/users/confirmation. Visitors may encounter functionality issues with group pages, navigation, missing content, broken links, etc. As you explore the new site, please provide your feedback using the UserSnap tool on the bottom right corner of each page. Thank you for your understanding and support as we work through all issues as quickly as possible. Stay updated about upcoming features and functionalities: https://www.rd-alliance.org/rda-web-platform-upcoming-features-and-functionalities/

Fwd: YACA – Yet another collection API

  • Creator
    Discussion
  • #80997

    RDA Admin
    Member

    ——– Weitergeleitete Nachricht ——–
    Betreff: YACA – Yet another collection API
    Datum: Thu, 2 Feb 2017 15:03:18 +0100
    Von: Thomas Zastrow

    An: Tobias Weigel , Baumgardt, Frederik
    , Almas, Bridget M.
    Following the CRUD approach, this would be:
    – List all existing collections
    – Create a collection
    – Read a collection (returning all items it contains)
    – Add an item to a collection
    – Delete an item from a collection
    – Delete a collection
    Implementing these functions should make up at least a basic collection
    API. It is not saying anything about items, recursion etc. – but I’m
    sure that for many use cases it will fit.
    So swimming without water is useless, I finished implementing this
    functionality in my PHP script and you can test it. Its no longer about
    stub functions, it really works. I tried to follow the Swagger API as
    close as possible, ignoring all the optional stuff. Please use simple
    strings for the collection and item names, no special characters,
    whitespaces etc.:
    — List all collections:
    curl -X GET https://thomas-zastrow.de/collections/api.php/collections/
    []
    (If there is no collection so far, an empty Json array [] is returned.)
    — Creating a new collection:
    curl -X POST https://thomas-zastrow.de/collections/api.php/collections/col1
    {“success” : ” Collection ./store/col1 was created”}
    — Adding an item to a collection:
    curl -X POST
    https://thomas-zastrow.de/collections/api.php/collections/col1/itemA
    {“success” : ” Item itemA was added to collection ./store/col1″}
    — Listing the content of a collection:
    curl -X GET https://thomas-zastrow.de/collections/api.php/collections/col1
    [“itemA”,”itemB”,”itemC”]
    — Deleting an item:
    curl -X DELETE
    https://thomas-zastrow.de/collections/api.php/collections/col1/itemB
    {“success” : ” All appearances of item itemB in collection ./store/col1
    were deleted”}
    — Delete a collection:
    curl -X DELETE
    https://thomas-zastrow.de/collections/api.php/collections/col1/
    {“success” : ” Collection ./store/col1 was successfully deleted”}
    ————————————————-
    The whole thing is on GitHub: the PHP code in api.php, a .htaccess file
    with a rewrite rule and an empty folder “store” where the new to created
    collections are stored:
    https://github.com/TomZastrow/collection-api.git
    Cloning it to a PHP- and rewrite-enabled Apache webserver should do the job.
    Best,
    Tom

    Dr. Thomas Zastrow
    Max Planck Computing and Data Facility (MPCDF)
    Gießenbachstr. 2, D-85748 Garching bei München, Germany
    Tel +49-89-3299-1457
    http://www.mpcdf.de

Log in to reply.