Error: No response from server
-
Hello,
I don’t understand why my JSON URL isn’t working.
Here’s the URL: https://www.monbacasable.com/wp-json/wp/v2/slider/441
Access in browser works fine.But there’s still an error on Templater (see capture in attchment).
Perhaps my JSON code isn’t correct. But in any case, access should work.
Even a directly hosted JSON file doesn’t work: https://www.monbacasable.com/data.jsonI did add a header.
Thank you
-
I checked the URL that you provided, and I think it should work as long as we add open and close brackets to the beginning and end of the data block to signal to Templater that it’s reading from an array of objects. I wasn’t able to test that with the URL feed, but when I copied the data to a local file and added the brackets, it seemed to work fine.
As for the locally hosted file, I’m curious about what happened when we tried to use it as our data source. I was able to link to the “data.json” file without an issue and preview data in Templater. Was there an error message in the status section of the Templater Panel?
Let us know, and we’ll see what we can do to resolve this issue.
Thanks,
Jeff
-
@fofilou to add to what Jeff said, there’s an extra comma after the third object in the
data.jsonarray, which makes the JSON syntax technically invalid and might be what is tripping up Templater.As for the response from the wp-json REST API, Templater needs a flat array of non-nested objects (each object being a single “job”), but the API is returning an object with other nested objects and arrays. I didn’t see the attachment come though, but it’s likely that any access failure message is actually because it couldn’t parse the data without the root of the response being an array. If you want to use that data, you would need to create a custom endpoint that is transforming that data into the correct data structure.
-
Thank you for your help.
I simply uninstalled Templater and reinstalled the latest version, and it works!
One quick question: how do I reset ALL images loaded from a JSON file when the image source is different?
To generate a new projetThere must be a function to refresh all the images? Without having to go through them one by one.
It’s the clock button ?Thanks