CA
genetic-orange

How to access key-value-stores via api?

I want to access a file I created in key-value-stores via api but Store ID keeps changing for every run. How can I access that file?
3 Replies
HonzaS
HonzaS2y ago
you can change the actor to put the file to the named key-value-store then it will be same for all runs or you can get default key value store id of the run via api
genetic-orange
genetic-orangeOP2y ago
@HonzaS thanks, the file is already in key_value_stores/default but accessing that file via api url is not possible because it requires Store Id which changes in run time do you have an example?
HonzaS
HonzaS2y ago
if you have at least id of the actor, then you can get list of runs via API https://docs.apify.com/api/v2#/reference/actors/run-collection/get-list-of-runs and then get the id of the last run and then you can get to the keyvaluestore records just look to the docs https://docs.apify.com/api/v2#/reference/actor-runs/run-object-and-its-storages

Did you find this page helpful?