When consuming a rest service it is unable to find a key but if it is set to create then it makes an object with the element of the key

0
I am working with pokeapi to practice consuming rest services. Currently I am trying to import items from the api into my project I am encountering odd behavior. using this json structure for my import mapping. { "id": 1, "name": "master-ball", "cost": 0, "fling_power": 10, "fling_effect": { "name": "flinch", "url": "https://pokeapi.co/api/v2/item-fling-effect/7/" }, "attributes": [ { "name": "holdable", "url": "https://pokeapi.co/api/v2/item-attribute/5/" } ], "category": { "name": "standard-balls", "url": "https://pokeapi.co/api/v2/item-category/34/" }, "effect_entries": [ { "effect": "Used in battle\n: [Catches]{mechanic:catch} a wild Pokémon without fail.\n\n If used in a trainer battle, nothing happens and the ball is lost.", "short_effect": "Catches a wild Pokémon every time.", "language": { "name": "en", "url": "https://pokeapi.co/api/v2/language/9/" } } ], "flavor_text_entries": [ { "text": "The best Poké Ball with the ultimate level of performance. With it, you will catch any wild Pokémon without fail.", "version_group": { "name": "x-y", "url": "https://pokeapi.co/api/v2/version-group/15/" }, "language": { "name": "en", "url": "https://pokeapi.co/api/v2/language/9/" } } ], "game_indices": [ { "game_index": 1, "generation": { "name": "generation-vi", "url": "https://pokeapi.co/api/v2/generation/6/" } } ], "names": [ { "name": "Master Ball", "language": { "name": "en", "url": "https://pokeapi.co/api/v2/language/9/" } } ], "sprites": { "default": "https://pokeapi.co/media/sprites/items/master-ball.png" }, "held_by_pokemon": [ { "pokemon": { "name": "chansey", "url": "https://pokeapi.co/api/v2/pokemon/113/" }, "version_details": [ { "rarity": 50, "version": { "name": "soulsilver", "url": "https://pokeapi.co/api/v2/version/16/" } } ] } ], "baby_trigger_for": { "url": "https://pokeapi.co/api/v2/evolution-chain/1/" } } On my import mapping I am using a microflow to check if the “name” attribute of the root object exist and if it does not then to create a new object   If I just have the root object in the mapping when I call the rest services it passes the “name” into the parameter of the mapping microflow and it works as intended. When I map more attributes no matter what it always passes an empty string into the parameter, even though I have confirmed that with the same call there is a value that should be passed. Since an empty string is passed the microflow says it is not found and then creates a new object. But when it creates the object the correct “name” attribute the same one that was passed as empty is correctly made.
asked
1 answers
0

Hi Massimo,

This isn’t a direct answer to your problem but another approach you can use here is to use ‘find object by key’ instead of ‘call microflow’ and set either the name or the id as the key.  This should have the same result as you are trying to achieve here.

Hope this helps

Danny

answered