Poems to Go

‹ Go back home

This API serves the poems featured on this site. Why does a poetry website need an API? I don't know.

Documentation

The API is free to use, just try not to break anything. The base URL is https://www.beanpoems.com/api/. The poem text uses \n to specify line breaks in the poem.

Get all poems

GET https://www.beanpoems.com/api/poems

Returns all of the poems

[
    {
        "title": "Coffee",
        "description": "A poem about coffee",
        "date": "2020-07-15T20:00:00.000Z",
        "categories": ["Coffee", "Life"],
        "body": "Heat and the beans and ...",
        "id": 0
    },
    ...
]  

Get one poem

GET https://www.beanpoems.com/api/:id

Returns a poem specified by :id. If the ID provided is not a number or if the poem does not exist, then a 400 status code and an error message are returned.

{
    "title": "The Mango",
    "description": "A poem about the mango",
    "date": "2020-08-13T21:30:00.000Z",
    "categories": ["Life", "Nature"],
    "body": "For weeks they wait, a...",
    "id": 2
}                           

Get a random poem

GET https://www.beanpoems.com/api/random

Returns a random poem from the site. This could be used as part of a Magic Mirror or as a "Poem of the Day" feature.

{
    "title": "The Octopus Project",
    "description": "A poem about octopi",
    "date": "2020-06-26T19:00:00.000Z",
    "categories": ["Nature", "Ocean"],
    "body": "This octopus tells ..."
    "id": 3
}