Giter Site home page Giter Site logo

quotable's Issues

[Feature Request] Get a quote with a maximum length

The Request
What would be really nice is the ability to use a GET parameter to specify the maximum or minimum length of a desired quote.
like this:

Expected Behavior:
https://api.quotable.io/random?maxlen=50 => gives a random quote with a length of no more than 50 characters
https://api.quotable.io/random?minlen?=20 => gives a quote with at least 20 char length.
and so on.

Suggestions
Adding a length entry and then sorting the database by length. Now get the section that has 0 to n characters and select a random one.

Api Down

Discussed in #127

Originally posted by khushalpatel1 June 17, 2022
Hello sir api is not woring please help...

[Feature Request] Web Links For Authors

A lot of the authors in the quotes have bios that would be interesting to read, especially those on, say, Wikipedia. My feature request is to add these somehow (I guess in the Authors collection, if not into the quotes themselves (de-normalised, effectively, for ease of consumption).

Would you consider adding a "link" field (and possible even a photo url field) to the authors collection? I'd be happy with both pieces of work (A: adding the fields, and B: populating some of the authors themselves) if you'd like? Similar to my other request, I'd of course need access to the backend for 'B'.

Error: A server with the specified hostname could not be found

Luke,

Sorry for not getting back to you before you closed issue 10. Things have been a little crazy over the holidays. I feel like quotable worked when you first linked the codepen and code sandbox, but after several more attempts it is not working for me over the past couple of days.

I tried FF Dev, Chrome and Safari browsers.

[Error] Error while parsing the 'sandbox' attribute: 'allow-presentation' is an invalid sandbox flag. (RwNVeQG, line 851)
[Error] Failed to load resource: A server with the specified hostname could not be found. (random, line 0)
[Error] Unhandled Promise Rejection: TypeError: A server with the specified hostname could not be found.
	(anonymous function) (RwNVeQG:66)
	asyncFunctionResume
	(anonymous function)
	promiseReactionJob

Here are some screenshots of the errors from Safari/codepen.
https://res.cloudinary.com/jastuccio/image/upload/v1577771339/quotable%20github%20errors/Screen_Shot_2019-12-31_at_00.24.40.png

https://res.cloudinary.com/jastuccio/image/upload/v1577771338/quotable%20github%20errors/Screen_Shot_2019-12-31_at_00.25.23.png


I found this in a search about the sandbox error:

http://stackoverflow.com/a/33542435:

This error can be safely ignored, the script will continue to run fine. These are two new flags which have been implemented in Chrome 46 (the current stable release). If you're testing in a browser that doesn't support them, you'll see that error (which is really just a warning).

The allow-modals flag is required because Chrome will, by default, block modal dialogs within a sandboxed iframe. Adding this flag allows modals to work in your apps scripts

.

enhancement: improve pagination API

Summary

Add support for page number based pagination. This approach is simpler and more intuitive. It also requires less code on the client side to implement common pagination patterns.

This feature can be added on top of the current API without any breaking changes.

Example

Get the second page of results, with 50 results per page.

GET /quotes?page=2&limit=50

New Parameters

Add a page parameter to all paginated endpoints. This parameter can be used to specify the page of results to return. The limit param determines the number of results per page.

Paginated Response

We can add the following properties to all paginated responses. We do not need to remove or modify any existing properties on the response.

  • page the current page of results
  • totalPages total number of pages based on results per page

Implementation

When the skip parameter is provided to a paginated endpoint, the page param will be ignored. Otherwise, the value of skip will calculated from page and limit (results per page). This way the current pagination API will still be supported.

const skip = skipParam || (page - 1) * limit

bug(/authors/:id) does not return expected response

Description

The method /authors/:id does not return the correct response.

Steps to reproduce

GET https://api.quotable.io/authors/N5lVXx7ZOkGV

Expected result

According to the documentation, the response should be an object with the following fields.

{
  _id: string
  name: string
  quoteCount: number
  quotes: Array<{
    _id: string
    content: string
    author: string
    length: number
    tags: string[]
  }>
}

Actual result

The items in the quotes array do not have the correct properties

{
  "_id": "N5lVXx7ZOkGV",
  "name": "Alexander Chalmers",
  "quoteCount": 1,
  "quotes": [
    {
      "_id": "zTK-zsh2HysH",
      "__v": 0
    }
  ]
}

Environment

API Client: Postman

[Feature Request] Add tag(s) to quotes

I'm just considering to extend API with a new feature - selecting quotes by a tag name. But firstly each quote object has to contain tag or tags property in it. I'm not sure how hard is to add tag/tags to each quote since my English is not my native language. What do you think?

[Feature] Search quotes

Description

An API method to search quotes. It should allow people to search for quotes by content, author, and possibly tags. Ideally, search results should be sorted by relevance.

API

GET /search/quotes

Query Params

param type Description
query String The string to search for
limit Int The number of authors to return per request. (for pagination)
skip Int The number of items to skip (for pagination)

Use Cases

1. Search for a specific quote or phrase

Ideally, this should work even if the query does not exactly match the quote

GET /search/quotes/?query=a divided house wont stand
GET /search/quotes/?query=divided house

Should both return the following quote

"A house divided against itself will not stand"

2. Search for quotes containing a keyword

GET /search/quotes/?query=love

Should return all quotes containing the word "love"

3. Search for quotes by author name

GET /search/quotes/?query=Lincoln

Typos

There are a considerable amount of typos in the quotes.

[Docs] Update documentation for tags endpoint

1. Update documentation for tags endpoint

README#get-tags should include a section with the following query parameters

  • param: sortBy
    type: enum: ["name", "quoteCount"]
    description: The field used to sort tags. Default is name.

  • param: sortOrder
    type: enum: ["asc", "desc"]
    description: The order in which results are sorted. Default order depends on the sortBy field.

2. Add the tags endpoint to the table of contents

Api down :(

Describe the bug
Error message :- Failed host lookup: 'api.quotable.io' (OS Error: No address associated with hostname,
image

To Reproduce

  1. Open an API client (Postman or Chrome)
  2. Make any API request
GET https://api.quotable.io/tags

feature: author profile images

Author Image Feature

Feature Request

  • To add author_image field or author_image_link field.

This update will look to add another feature in feature-rich Quote API.
It would be amazing to have the author's image along with the quote and bio.

Typo in README

Hi, I discovered Quota today and it helped me with my project :)
But I found one typo in README.md. Under "usage", you have:
jQuery Example

  $.getJSON('https://quota.glitch.me/random'), function(data) {
    console.log(`${data.quoteText} -${data.quoteAuthor}`)
  }

There is one extra right parenthesis after 'https://quota.glitch.me/random'
It should be: $.getJSON('https://quota.glitch.me/random', function(data) {...

API down again.

Describe the bug
Some error occurred that made the api unusable.
To Reproduce

  1. I Made the following API request
GET https://api.quotable.io/random?maxLength=50

Expected Response
The api request result is as follows:
image
Please check the situation,Thank you.

Add guide for new contributors.

I'm a new contributor. It'll be really great if a brief contributing guide exists in this project. Having a CONTRIBUTING.md file or something else with the contributing instructions.

So far I found that I need to do following steps before doing any changes in the codebase.

  1. Making sure that Node and MongoDB are installed on my local machine
  2. Create database of "quotable" on MongoDB
  3. Pass environment variable of MONGODB_URI when seeding database or starting the app and integration tests, e.g. "MONGODB_URI=mongodb://localhost:27017/quotable"

seeding database with

MONGODB_URI=mongodb://localhost:27017/quotable npm run database:seed data/sample

starting tests

MONGODB_URI=mongodb://localhost:27017/quotable npm test

starting the app

MONGODB_URI=mongodb://localhost:27017/quotable npm run start

Two lines short poetry

Description

Hi can you please add two lines poetry in database.. I didn't find two lines short poetry api on internet.. I am working on project that require Short poetry

Multiple Spelling / Grammar Errors

First of all, thanks so much for this project, I'm using inside a personal project of my own and love seeing the quotes!

There are, unfortunately, a whole bunch of spelling and grammar errors in a lot of the quotes. I'd love to help with these, but they're not part of the project itself, as far as I can see. Is there a way I could get access to the data store to help, if you'd like me to pitch in?

api slow down

Now api working but very slow some time working or some time not working...

API is down

Check the current status of the API servers. Does this show that the servers are down for everyone?

yes or no

Provide any additional information that might be helpful

Get Quotes by topic / genre

Feature

For Each Quotes, add genre as parameter and we can filter based on it. I can see that tag is also used for same purpose but not exactly the same.

Api Down

Api is again down please fix....

bug(listQuotes): author param not working on staging server

Describe the bug
Documentation states that to get quotes by author, user needs to hit API endpoint /quotes?author=albert-einstein although this does not work, should be updated to use authorSlug instead of author in the payload because that works. See attached snapshot.

To Reproduce

  1. Open an API client (Postman or Chrome)
  2. Make the following API request staging.quotable.io/quotes?author=abraham-lincoln
GET staging.quotable.io/quotes?author=abraham-lincoln

Expected Response
User should either get results by author or the document should be updated to get results by authorSlug

Actual Response
No Results.
Screenshot 2021-07-24 at 4 43 07 PM

Check Snapshot for the following API

staging.quotable.io/quotes?authorSlug=abraham-lincoln

Screenshot 2021-07-24 at 4 42 03 PM

docs(listQuotes): Add author param

In the /quotes, we have a query parameter to fetch quotes by using the author name Screenshot attached.
image

But It is not documented.
It is required to be updated.

Quotes in Urdu language

Description

I am working on a project that requires a English quotes in Urdu(ur) language. Can you please ๐Ÿฅบ add this language, if you can I will be very happy ๐Ÿ˜Š

bug(/quotes/id): response does not match documentation

Description

The method /quotes/:id does not return the expected response.

Steps to reproduce

  1. Make a request to
https://api.quotable.io/quotes/HxaMW05ghs7P

Expected result

The response should be an object with the following fields

content: string
author: string
length: number
tags: string[]

Actual result

Response does not include fields tags or length

Environment

NA

Search Author by name or keyword.

Description

There is no feature to search authors by their names, something like this.
https://quotable.io/authors?searchKeyword=einstein

If we hit the same endpoint with slug param it returns 0 (zero) results.
https://api.quotable.io/authors?slug=einstein

My Quote can run locally but not in Vercel

I'm using react axios to call this api, here is the code

import React, { useState, useEffect } from 'react'
import axios from "axios"

export default function Quote() {
    const [quote, setQuote] = useState("");
    const [author, setAuthor] = useState("")
    const quoteAPI = async () => {
        let arrayOfQuotes = [];
        try{
            const data = await axios.get("http://api.quotable.io/random")
            arrayOfQuotes = data.data;
        } catch(error){
            console.log(error)
        }

        try{
            setQuote(arrayOfQuotes.content)
            setAuthor(arrayOfQuotes.author)
        } catch(error){
            console.log(error)
        }
    }

    useEffect(() => {
        quoteAPI();
    }, [])

    
  return (
    <div className="quotes">
        <div className="word">
            {quote}
        </div>
        <div className="author">
            {author}
        </div>
        <div class="d-flex justify-content-center">
            <a class="btn btn-secondary btn-xl text-center " onClick={quoteAPI}><i class="fas fa-redo-alt"></i></a>
        </div>
    </div>
  )
}

it ran perfectly when i ran it locally, but when i deployed it to vercel and visited the site, the quote wasn't showing, any clue?

API is currently down

api.quotable.io is currently not working. Tried from multiple pc and IP address to verify. As well as checked isitdownrightnow.com to verify.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.