Rest API call not working

Hi
I’m having trouble with this rest call

Here’s the url I’m using, and it works in a browser and in terminal:
http://www.mywebsite.com/wp-json/wpstatistics/v1/summary?token_auth=abcdefgh

But I can’t get it to work in HA, I get state Unknown.

This is the code I’m using:

  - platform: rest
    resource: "http://www.mywebsite.com/wp-json/wpstatistics/v1/summary?token_auth=abcdefgh"
    name: "calltotal"
    scan_interval: 60

Here’s what the response should be:

{
	"user_online": "0",
	"visitors": {
		"today": 92,
		"yesterday": 52,
		"week": 144,
		"month": 144,
		"year": 144,
		"total": 144
	},
	"visits": {
		"today": 161,
		"yesterday": 75,
		"week": 236,
		"month": 236,
		"year": 236,
		"total": 236
	},
	"total_posts": 0,
	"total_pages": 7,
	"total_comments": 15,
	"total_spams": 0,
	"total_users": 1,
	"lastpostdate": "February 4, 2024",
	"average_post": 0,
	"average_comment": 0.08,
	"average_registeruser": 0
}

What I’m after is the visits.total

I’ve also tried using jq but not working in HA but works on my computer:

curl https://www.mywebsite.com/wp-json/wpstatistics/v1/validate?token_auth=abcdefgh  | jq '.visits.total'

Any help is appreciated.

No entity state can be more than 255 chars.
Workarounds have been published on the forum numerous times, already.

If you only want the total value then you have to add this, do read the doc on rest

value_template: "{{ value_json.visits.total }}"

Thank you! This was what I needed.