Widget Issue - Anybody See Where I went wrong?

I am back to trying to get the Quotes Widget from the Examples to work. Clearly I am missing something but I can’t see it…

This is what I have…


Shortcut runs with no errors.

Is there a way I can verify the data pulled from the website?

Doing this let’s you see the results:

When I use the API key you posted, it comes back as invalid (not authenticated), so I would double check that to start.

I ran:

> curl -v  -i -X GET -H 'X-TheySaidSo-Api-Secret:LAHmPI5mcMKK2x3IkE3hDwX1n6Vvey1KYPllPqfI'  https://quotes.rest/quote/random.json

And got:

* Trying 208.113.163.159:80...
> 
> * Connected to quotes.rest (208.113.163.159) port 80
> > GET /quote/random.json HTTP/1.1
> > Host: quotes.rest 
> > User-Agent: curl/8.4.0
> > Accept: */*
> > X-TheySaidSo-Api-Secret:LAHmPI5mcMKK2x3IkE3hDwX1n6Vvey1KYPllPqfI
> < HTTP/1.1 301 Moved Permanently
> HTTP/1.1 301 Moved Permanently
> < Date: Sun, 28 Apr 2024 00:01:37 GMT
> **Date**: Sun, 28 Apr 2024 00:01:37 GMT
> < Server: Apache
> **Server**: Apache
> < Location: https://quotes.rest/quote/random.json
> **Location**: https://quotes.rest/quote/random.json
> < Content-Length: 245
> **Content-Length**: 245
> < Content-Type: text/html; charset=iso-8859-1
> **Content-Type**: text/html; charset=iso-8859-1
> <
> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
> <html><head>
> <title>301 Moved Permanently</title>
> </head><body>
> <h1>Moved Permanently</h1>
> <p>The document has moved <"a href=https://quotes.rest/quote/random.json">here</a>.</p>
> </body></html>
> * Connection #0 to host quotes.rest left intact

So I went “ah ha” the endpoint is httpS not plain http…
Then I ran:

curl -v  -i -X GET -H 'X-TheySaidSo-Api-Secret:LAHmPI5mcMKK2x3IkE3hDwX1n6Vvey1KYPllPqfI'  https://quotes.rest/quote/random.json

This gave me:

Note: Unnecessary use of -X or --request, GET is already inferred.
* Trying 208.113.163.159:443...
* Connected to quotes.rest (208.113.163.159) port 443
* ALPN: curl offers h2,http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
* CAfile: /etc/ssl/cert.pem
* CApath: none
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-AES256-GCM-SHA384
* ALPN: server accepted h2
* Server certificate:
* subject: CN=www.quotes.rest
* start date: Mar 9 05:02:38 2024 GMT
* expire date: Jun 7 05:02:37 2024 GMT
* subjectAltName: host "quotes.rest" matched cert's "quotes.rest"
* issuer: C=US; O=Let's Encrypt; CN=R3
* SSL certificate verify ok.
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://quotes.rest/quote/random.json
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: quotes.rest]
* [HTTP/2] [1] [:path: /quote/random.json]
* [HTTP/2] [1] [user-agent: curl/8.4.0]
* [HTTP/2] [1] [accept: */*]
* [HTTP/2] [1] [x-theysaidso-api-secret: LAHmPI5mcMKK2x3IkE3hDwX1n6Vvey1KYPllPqfI]
> GET /quote/random.json HTTP/2
> Host: quotes.rest
> User-Agent: curl/8.4.0
> Accept: */*
> X-TheySaidSo-Api-Secret:LAHmPI5mcMKK2x3IkE3hDwX1n6Vvey1KYPllPqfI
>
< HTTP/2 401
HTTP/2 401
< date: Sun, 28 Apr 2024 00:03:19 GMT
**date**: Sun, 28 Apr 2024 00:03:19 GMT
< server: Apache
**server**: Apache
< cache-control: no-cache, private
**cache-control**: no-cache, private
< vary: User-Agent
**vary**: User-Agent
< content-type: application/json
**content-type**: application/json
<
* Connection #0 to host quotes.rest left intact
{"message":"Not authenticated"}**%**

So I am now talking to TheySaidSo about if my key is somehow borked.

Did you get any useful response from TheySaidSo? I’ve been looking into this from our end and concluding that the API seems to be rejecting keys for no particular reason; wondering if we need to find a different source of quotes for this example!

I did get a response through Facebook messenger, I sent them some examples of the errors, not heard back for a while…

Hi @dwrs
I got a response that “my token was supposed to auto extend but didn’t” apparently this has been fixed.

So then I tried one of the examples from the (They Said So) site:

curl -X 'GET' \      
  'https://quotes.rest/qod?language=en' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer LAHmPI5mcMKK2x3IkE3hDwX1n6Vvey1KYPllPqfI'

This give me a response!!!

{"success":{"total":1},"contents":{"quotes":[{"id":"CYwS9CTIVeHdhEZAR0yeOweF","quote":"Some men see things as they are and say why.. I dream things that never were and say why not.","length":95,"author":"George Bernard Shaw","language":"en","tags":["inspire"],"sfw":"sfw","permalink":"https:\/\/theysaidso.com\/quote\/george-bernard-shaw-some-men-see-things-as-they-are-and-say-why-i-dream-things-t","title":"Inspiring Quote of the day","category":"inspire","background":"https:\/\/theysaidso.com\/assets\/images\/qod\/qod-inspire.jpg","date":"2024-05-03"}]},"copyright":{"url":"https:\/\/quotes.rest","year":"2024"}}**%**

I have been trying and failing to convert this to a “Shortcuts SetUp” but I believe I have used up my “5 Requests a Day” on the free plan.

Matt

Ah, so I figured it out…

I had the:
Authorization as “Bearer: LAH…” it should have been “Bearer LAH…” without the “:”.

And I had used up my “5 a day”.

I also put the accept & Authorization into the advanced section of the “Get Contents of”.