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
hellosendpie
hellosendpie14mo ago
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
Hello, I’m Allie!
Hello, I’m Allie!OP14mo ago
You set it here:
No description
hellosendpie
hellosendpie14mo ago
Thank you so much! Does the
/accounts/{account_identifier}/storage/kv/namespaces/{namespace_identifier}/values/{key_name}
/accounts/{account_identifier}/storage/kv/namespaces/{namespace_identifier}/values/{key_name}
endpoint support this? Expiration only seems to work for me for the
https://api.cloudflare.com/client/v4
/accounts/{account_identifier}/storage/kv/namespaces/{namespace_identifier}/bulk
https://api.cloudflare.com/client/v4
/accounts/{account_identifier}/storage/kv/namespaces/{namespace_identifier}/bulk
endpoint I can see your screenshot is from the latter endpoint as well, but I need help with the former
hellosendpie
hellosendpie14mo ago
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.'
No description
Hello, I’m Allie!
Hello, I’m Allie!OP14mo ago
Maybe try with an expiration field? Would probably do it with a random key first though
hellosendpie
hellosendpie14mo ago
This 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.
{'result': [{'name': 'example_key'}], 'success': True, 'errors': [], 'messages': [], 'result_info': {'count': 1, 'cursor': ''}}
{'result': [{'name': 'example_key'}], 'success': True, 'errors': [], 'messages': [], 'result_info': {'count': 1, 'cursor': ''}}
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?
Hello, I’m Allie!
Hello, I’m Allie!OP14mo ago
No, I wouldn’t think so
Want results from more Discord servers?
Add your server