Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

webtag query

From build 3044 the development baton passed to Mark Crossley. Mark has been responsible for all the Builds since. He has made the code available on GitHub. It is Mark's hope that others will join in this development, but at the very least he welcomes your ideas for future developments (see Cumulus MX Development suggestions).

Moderator: mcrossley

Post Reply
User avatar
HansR
Posts: 6926
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bookworm
Location: Wagenborgen (NL)
Contact:

webtag query

Post by HansR »

When querying webtags with the URL:

Code: Select all

http://localhost:8998/api/tags/process.json?Extra Station Info: 
apparently some get the response

Code: Select all

TokenParser error in file: , InputString is zero length
From what I can tell, the response.StatusCode is "OK" and the StatusPhrase is also "OK".

Under which condition does CMX produce this response?

And yes, the Extra Station Info may or may not contain a webtag at the end so the query may or may not contain a webtag. Until now that has never been an issue.
Hans

https://meteo-wagenborgen.nl
CMX build 4070+ ● RPi 4B ● Linux 6.6.62+rpt-rpi-v8 aarch64 (bookworm) ● dotnet 8.0.1
BlueSky: https://bsky.app/profile/wagenborgenwx.bsky.social
User avatar
mcrossley
Posts: 14384
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: webtag query

Post by mcrossley »

It looks like the API tag processor is not thread safe, sigh :(
So, it can happen if two calls to the tags API overlap.

I'll see if I can fix it for the next release, I already put a fix in to change the return code/returned text on error.
User avatar
HansR
Posts: 6926
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bookworm
Location: Wagenborgen (NL)
Contact:

Re: webtag query

Post by HansR »

OK, thanks.
Hans

https://meteo-wagenborgen.nl
CMX build 4070+ ● RPi 4B ● Linux 6.6.62+rpt-rpi-v8 aarch64 (bookworm) ● dotnet 8.0.1
BlueSky: https://bsky.app/profile/wagenborgenwx.bsky.social
User avatar
mcrossley
Posts: 14384
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: webtag query

Post by mcrossley »

That really isn't the way the API was intended to be used though. It expects a list of web tag names. If you want to process free text then the POST method should be used.
User avatar
HansR
Posts: 6926
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bookworm
Location: Wagenborgen (NL)
Contact:

Re: webtag query

Post by HansR »

mcrossley wrote: Thu 09 Nov 2023 10:28 pm That really isn't the way the API was intended to be used though. It expects a list of web tag names. If you want to process free text then the POST method should be used.
OK. I verified it and indeed I do use the Post method as follows:

Code: Select all

    using ( StringContent requestData = new StringContent( data, Encoding.UTF8 ) )
    {
        using ( HttpResponseMessage response = await PostClient.PostAsync( thisURL, requestData ) )
        {
            if ( response.IsSuccessStatusCode )
            {
                retval = await response.Content.ReadAsStringAsync();
                Sup.LogTraceInfoMessage( $"PostUrlData success response : {response.StatusCode} - {response.ReasonPhrase}" );
            }
            else
            {
                Sup.LogTraceErrorMessage( $"PostUrlData : Error: {response.StatusCode} - {response.ReasonPhrase}" );
                retval = "";
            }
        } // End using response -> dispose
    } // End using requestData -> dispose
Just to simplify I gave the example through the Get in the browser. Sorry for that. I assume the Tag parser does not differ?
Hans

https://meteo-wagenborgen.nl
CMX build 4070+ ● RPi 4B ● Linux 6.6.62+rpt-rpi-v8 aarch64 (bookworm) ● dotnet 8.0.1
BlueSky: https://bsky.app/profile/wagenborgenwx.bsky.social
User avatar
mcrossley
Posts: 14384
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: webtag query

Post by mcrossley »

HansR wrote: Fri 10 Nov 2023 1:25 am Just to simplify I gave the example through the Get in the browser. Sorry for that. I assume the Tag parser does not differ?
It does work a bit differently, but ultimately it uses the same token parser
Post Reply