We are looking to use the Qwik API for display content on our site, but in testing are noticing that when you hit the API url for any particular piece of content, and then change the content in Builder, the API does not return the updated content. We are passing cacheSeconds=1&staleCacheSeconds=1 but no luck. How long does the API cache existing content and is there any way to force a refresh? Either through the Builder interface or using a parameter in the API URL?
Can you share the full URL you are using and I will have a look what is going on.
I just checked again and it does look like the API response has updated since I opened this topic - so maybe it’s accurate to say that the cache updates every 2 hours or so? Any way to force that update if we need to register an immediate change?
cachebust=true => https://cdn.builder.io/api/v1/qwik/page/cb79fc0021744663b043574c29ea26fe?apiKey=f682923328d54516b4ba21bfabd7faad&cachebust=true should do the trick. Can you give it a try and report back.
That parameter does not appear to do anything.
After looking into this more, it appears we can just duplicate a piece of content and then update the API call with the new ID to pull the new content.
In most cases waiting 2 hours for the cache to update and the API to return the new results is not a problem, but in certain circumstances it’s an issue - for example if we unpublish a piece of content, the API will still return the cached version after the content has been unpublished. I’ve verified that this happens. It looks like the Qwik API is run through Cloudfront, it would probably be worth it to send an invalidation request to the Cloudfront API when content gets unpublished.
https://cdn.builder.io/api/v1/qwik/page/cb79fc0021744663b043574c29ea26fe?apiKey=f682923328d54516b4ba21bfabd7faad&cachebust=true shows not-found. Looks like you have moved the content. Can you send me a link to the new content so I can investigate further? Trying to understand why
cachbust=true does not work for you.
Here is a test page I have created: https://cdn.builder.io/api/v1/qwik/page/8317da2f35b14165a5f7ec0ee5d961d8?apiKey=f682923328d54516b4ba21bfabd7faad&cachebust=true
It does look like with the cachebust parameter added the content will be updated within about 5 minutes. I would expect it would happen in a few seconds, 5 minutes isn’t really a “cachebust”. If you need to view the published result as you’re developing the page having to wait 5 minutes every time is a bit difficult.
We have switched to use the HTML API as it updates almost instantly when we publish content and we’ve encountered a couple strange issues with the Qwik API, for example a page randomly started throwing this error and we can’t figure out how to fix it (https://cdn.builder.io/api/v1/qwik/page/0acba480fa954adfb37b7a6f4d2b5a77?apiKey=f682923328d54516b4ba21bfabd7faad&cachebust=true).
I like the idea of the Qwik API but it’s been way too unstable for any type of production use (beyond very basic HTML content).
Yes, totally agree. I have been able to reproduce this locally, so I am looking into what is going on. Will have an update for you soon.
We have added a preview section to the documentation. Builder.io Qwik API - Builder.io Let me know if that does not solve the problem.