ThingHTTP Example not working

7 views (last 30 days)
E VdH
E VdH on 26 Mar 2020
Hey,
I'm really new on this and I really don't know how y'all doing it, but I can't even get the ThingHTTP Example to work.
Whatever I'm trying, I always get the message "Error parsing document, try a different parse string."
I'm creating a new ThingHTTP and it brings me to the page with all the parameters.
From the example, step 1, I copy the "https" bitcoin-link into the URL-field. Method is left at "GET"
Finally, from the example, step 3, I copied the full X-Path into the "Parse String" field and clicked "Save ThingHTTP", which brougth me back to the first page.
I copied the "https://api.thingspeak.com/apps/thinghttp/send_request?api_key=XXXXXXXXXXXXXXXX" into a new browserpage and I'm back at the error message.
So I thougth something was changed on the "bitcoin" site.
Went to "https://www.coinbase.com/price/bitcoin", (I'm using Chrome) and selected the element I wanted, and copied the full X-Path from there.
Again, pasted into the "Parse Field" and saved the ThingHTTP again.
I copied the "https://api.thingspeak.com/apps/thinghttp/send_request?api_key=XXXXXXXXXXXXXXXX" into a new browserpage and yet again........back at the error message.

Accepted Answer

Vinod
Vinod on 26 Mar 2020
Edited: Vinod on 26 Mar 2020
It appears Coinbase changed their CSS or page layout, yet again. Try this instead:
In the URL field, enter: https://cointelegraph.com/
In the parse string field, enter: //*[@id="header"]/header/div/div[1]/div/div[2]/ul/li[1]/a/span[2]
Now make the ThingHTTP request from your browser. Does it work?

More Answers (1)

Ryszard Olszewski
Ryszard Olszewski on 17 Jun 2020
Hi,
I have the same issue with website Investing.com
When I try get price quote f.ex. from website https://www.investing.com/indices/us-spx-500 I get message:
"Error parsing document, try a different parse string."
Probably something they changed, because everything was working fine for many weeks until now.
When I inspect Xpath I can see that this is the same as previous one, so I don't know what can I do.
Could you help me find any solution?
Many thanks!
  4 Comments
Vinod
Vinod on 23 Sep 2020
Edited: Vinod on 23 Sep 2020
You can always have your MATLAB code have the "weekends" logic and write the price to your channel only on weekdays (and in your timezone, if that matters). Let TimeControl execute the MATLAB code every 5 minutes. At this time, every 5 minutes is the most frequently a TimeControl can schedule a MATLAB code execution.
Ryszard Olszewski
Ryszard Olszewski on 1 Nov 2020
I've noticed that values stored in Channels don't have two decimal points.
For example when value from MATLAB code is "123.00", then in the Channel only "123" is stored. In this way I got values with different, random lenght which is not good for my project. I use "format bank" in MATLAB analyse code.
I've tried some functions which convert string to float or double, but "0.00" is returned. Is there any chance to save to- or read from channel values always with two decimal digits - "1.23"?
Moreover it would be really nice if positive values would be with "+" at the beginning.

Sign in to comment.

Communities

More Answers in the  ThingSpeak Community

Categories

Find more on Read Data from Channel in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!