Cloudflare API Documentation
You would probably have to call the API manually
Cloudflare API Documentation
Interact with Cloudflare's products and services via the Cloudflare API
7 Replies
Ah, thanks! I'll make my own wrapper in that case.
https://developers.cloudflare.com/api/operations/workers-kv-namespace-write-key-value-pair-with-metadata
^ Do I need to set "expiration" value within the metadata object?
Cloudflare API Documentation
Interact with Cloudflare's products and services via the Cloudflare API
You set it here:
Thank you so much!
Does the
endpoint support this?
Expiration only seems to work for me for the
endpoint
I can see your screenshot is from the latter endpoint as well, but I need help with the former
This one doesn't show any expiration keys, but the documentation still says 'Existing values, expirations, and metadata will be overwritten. If neither expiration nor expiration_ttl is specified, the key-value pair will never expire. If both are set, expiration_ttl is used and expiration is ignored.'
Maybe try with an
expiration
field? Would probably do it with a random key first thoughThis is a fresh namespace, I'm all okay with tinkering around.
I'll try a bunch of permutation combinations and check
When I request my data, I can't see "expiration" as a key set here.
When I use /bulk/ endpoint, it sets an "expiration" epoch key to my data.
I'm guessing in that case, this isn't really supported?
Yup! It's not working. I'll find a place to report this bug.
Since the /bulk/ endpoint seems to be working for setting expiration/expiration_ttl:
- would there be any risk (w.r.t api limits) in just using the /bulk/ API endpoint, but adding just 1 array element each time I meed to make a write?
No, I wouldn’t think so