Free API - Inspirational quotes JSON with code examples

Is there a way to get only a certain number of quotes in the request?

2 Likes

Thank you for this!! API is gone tho, was working fine yest, it is now a keyboard typing practice web application :confused:

1 Like

Hi @AngieBR, thanks for your interest and reporting the issue.
API restored, please check https://type.fit/api/quotes
The service was moved to another CDN provider (Cloudflare).

1 Like

Hi @ab91, sure, you’re welcome )

1 Like

Hi @dangerpwnd, sure, you’re welcome!
Please post here where do you use those quotes. Cheers

1 Like

Please post here where do you use those quotes. Cheers

Hi @Vlad246, thanks for your interest.
Currently parametrised requests are not supported. The endpoint works as is.

1 Like

Thank you so much for fixing the issue :slight_smile: You’re a great contribution to my learning :smiley:

Sure, @AngieBR, you’re welcome.
Please share a link here, where do you use this API.

Sounds good, I am finishing up a Medium post discussing the project this weekend, I will reply back with the link

1 Like

Is this API site down ? I was using it earlier for a fun project.

1 Like

Hey @SergeyWebPro I’m currently using this API with a python script that builds an image using one of the quotes, selected at random, and posts the image in an AppData folder for Outlook. This allows me to have new inspirational quotes in the signature of my emails everyday. Thanks again!

1 Like

Hi @caz, good to know you use it for a fun project.
Just checked, the API is up and running https://type.fit/api/quotes

Out of curiosity…

I am seeing the following console error when making the call from my app:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://type.fit/api/quotes. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing)

My research suggests that this is due to a security feature on the server side, one that is not able to bypassed outside of a hackier use of jsonp. However, I can still retrieve the resource by just pasting the URL in my browser…which makes me think I am doing something wrong here…

Thank you for having this available at all, but was curious as to if this was intentional?

2 Likes

Hi @ab91 thanks for reporting that.
I’ve recently added Cloudflare support, the original header settings were overwritten.
You’re right the issue is caused by CORS: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers

I’ve just updated the header to allow requests from other domains. Please check.

1 Like

I’ve also been experiencing the same behaviour this morning…

I tried using the API today too, however I also have the same problem.

Thanks for taking a look at this!

I am wondering if the response header needed is the one below:
Access-Control-Allow-Origin: *

Reviewing the documentation for Access-Control-Allow-Headers, the header responds to a browser’s pre-flight request (which includes a Access-Control-Request-Headers header from the client-side).

My hypothesis is that that may not be directly related to the issue at hand. It seems that addition of the Access-Control-Allow-Origin: * response header would solve the CORS issue as it would allow calls from any origin instead of just http://type.fit.

Sorry for bugging you on this! This is first time I am running into a CORS issue so I have been forced to finally learn it, which is fantastic.

Having the same issue as ab91. I’m also a novice with these things but I thought I’d chime in anyway. I’ll be following along :slight_smile:
Question, I’m working with my app on “localhost”, would this cause the issue since perhaps my localhost server isn’t permitted to access the url?

Hi, I was also using this API and it stopped working due to the CORS issue. This is such a cool API, thanks for building it! I hope you can get it up and running again. We appreciate it so much.