Retrieve keys in data store to bulk delete with Make API

Hello I’m not having any luck with one of my script. I need to search records in data store. When I run the module it will return to me multiple bundle see screenshot:
vivaldi_2OCmN8oL8g

The key is what I want to retrieve and parse into the make API to delete bulk records with keys in an json. Format should look like this at the end:

{“keys”:[“1abd2defk”,“568tyuj45”]}

So far I have this but I’m far off…

Thank you very much

Use the ‘Array Aggregator’ to collect all the ‘Key’ values from the bundles into an array. Then you will map array ‘Key’ to the use the ‘JSON’ module to create the JSON structure. Here you will structure the collected array into the format {"keys": Array}.

2 Likes

Welcome to the Make community!

Firstly, Make has it’s own app, you can use the Make an API call module instead of HTTP:

Screenshot_2024-01-19_200151

Secondly, according to the API documentation for Delete data store records, the request body should be as follows:

{
  "keys": [
    "1abd2defk",
    "568tyuj45"
  ]
}

You’ll need a minimum of three modules:

1. Aggregate to Text

Screenshot_2024-01-20_150122

2. Make an API Call

Screenshot_2024-01-20_150140

Give it a go and let us know if you have any issues!

2 Likes

Thank you very much. Very clear it works great. You are a genius!