Poetry API

The Poetry API provides access to a database of poems based on author, title, or randomly selected poems.

Base URL

"https://openapi-idk8.onrender.com"


Endpoint 1


Fetch Poetry by Author
GET `/poetry/author/:author`

Description: Retrieves poems by a specific author.

Parameters:

  • author: Name of the author whose poems to retrieve.

Sample Response

[
    {
        "title": "A Lover's Complaint",
        "author": "William Shakespeare",
        "lines": [
            "FROM off a hill whose concave womb reworded",
            "A plaintful story from a sistering vale,",
            "My spirits to attend this double voice accorded,",
            "And down I laid to list the sad-tuned tale;",
            "Ere long espied a fickle maid full pale,",
            "Tearing of papers, breaking rings a-twain,",
            "Storming her world with sorrow's wind and rain.",
            ...
             "linecount": "6"
        ]
    }
]
Fetch Poetry by Title
GET `https://openapi-idk8.onrender.com/poetry/title/blue`

Description: Retrieves poems by a specific title.

Parameters:

  • title: Title of the poem to retrieve.

Sample Response

[
    {
        "title": "I noticed People disappeared",
        "author": "Emily Dickinson",
        "lines": [
            "I noticed People disappeared",
            "When but a little child --",
            "Supposed they visited remote",
            "Or settled Regions wild --",
            "But did because they died",
            "A Fact withheld the little child --"
        ],
        ...
        "linecount": "6"
    }
]
Fetch Random Poetry
GET `https://openapi-idk8.onrender.com/poetry/random`

Description: Retrieves a random poem from the database.

Sample Response

[
    {
        "title": "Random Poem",
        "author": "Unknown",
        "lines": [
            "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
            "Pellentesque nec justo in nisi efficitur congue.",
            ...
             "linecount": "6"
        ]
    }
]

Error Handling

500 Internal Server Error: Returned when there's an issue fetching poetry from the server.

Response Body:


{
    "error": "Failed to fetch poetry"
}