Poems

Poems

Books

Return poem of the day and random poems. You can also search for poems based on author, tag, and keyword, and you can access a private poem collection.

Visit API

📚 Documentation & Examples

Everything you need to integrate with Poems

🚀 Quick Start Examples

Poems Javascript Examplejavascript
// Poems API Example
const response = await fetch('https://poems.one/api/poem/', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json'
    }
});

const data = await response.json();
console.log(data);

#Using the Poems.one API with JavaScript

Are you a lover of poetry? Do you want to get access to a collection of poems programmatically? Poems.one provides a public API that allows developers to fetch poems from their database.

##Requirements

To use the Poems.one API, you need an API key. You can get it by visiting the official Poems.one website [https://poems.one/] and creating an account. Once you have your API key, you are ready to use the API.

##API Endpoints

The Poems.one API provides two endpoints for you to fetch poems. These are:

  1. /api/poem/
  2. /api/random/

##Fetching a random poem

To fetch a random poem, you can use the /api/random/ endpoint.

    fetch("https://poems.one/api/random", {
        headers: {
          "X-API-KEY": "YOUR_API_KEY"
        }
      })
      .then(response => {
        if(!response.ok) {
          throw new Error('Network response was not ok');
        }
        return response.json();
      })
      .then(json => console.log(json))
      .catch(error => console.log('Error:', error));

##Fetching a poem by ID

To fetch a poem by ID, you can use the /api/poem/ endpoint.

    fetch("https://poems.one/api/poem/1", {
        headers: {
          "X-API-KEY": "YOUR_API_KEY"
        }
      })
      .then(response => {
        if(!response.ok) {
          throw new Error('Network response was not ok');
        }
        return response.json();
      })
      .then(json => console.log(json))
      .catch(error => console.log('Error:', error));

In the above examples, replace "YOUR_API_KEY" with your actual API key.

##Conclusion

The Poems.one API is a simple, yet useful tool for developers who want to fetch poems programmatically. With a few lines of JavaScript, you can access a large collection of poems and use them in your applications or projects.

📊 30-Day Uptime History

Daily uptime tracking showing online vs offline minutes

Jun 10Jun 12Jun 14Jun 16Jun 18Jun 20Jun 22Jun 24Jun 26Jun 28Jun 30Jul 2Jul 4Jul 6Jul 904008001440Minutes
Online
Offline

Related APIs in Books