Hello everyone! I’ve encountered an unpleasant issue. I can’t figure out how to pass results from an API to the workflow if the values in the response change.

For example, when connecting to SUNO, the response looks like this:

{
  "code": 200,
  "data": {
    "task_id": "76415de1-6d21-4405-a954-e6807dde2e82",
    "status": "completed",
    "input": "{\"custom_mode\":false,\"gpt_description_prompt\":\"bla-bla-bla\",\"make_instrumental\":false,\"prompt\":\"\",\"title\":\"\",\"continue_at\":0,\"continue_clip_id\":\"\",\"mv\":\"chirp-v3-5\",\"tags\":\"\"}",
    "clips": {
      "0925b59b-1eef-4e03-a854-6903365001ef": {
        "id": "0925b59b-1eef-4e03-a854-6903365001ef",
          "duration": 162.4,
          "error_message": ""
        },
        "is_liked": false,
        "play_count": 0,
        "upvote_count": 0,
        "is_public": false
      },
      "9c051494-9419-4643-b704-7871d9fee0f1": {
        "id": "9c051494-9419-4643-b704-7871d9fee0f1",
          "duration": 118.48,
          "error_message": ""
        },
        "is_liked": false,
        "play_count": 0,
        "upvote_count": 0,
        "is_public": false
      }
    },
    "metadata": {
      "created_at": "2024-07-07T20:21:31.113653292Z",
      "started_at": "2024-07-07T20:21:32.006014117Z",
      "ended_at": "2024-07-07T20:24:32.834624799Z",
      "quota_frozen": 10,
      "quota_usage": 10
    }
  },
  "message": "success"
}

Sooooo, this values are random IDs


And they’ll be change every call. I cant use “Result of step #” in my FW.

image

How would you solve this problem?

Consider this suggestion:

1 Like

Yea Javascript in a plugin action needs to restructure the JSON a little bit into a proper array like:

(rest of the fields),
"clips:": [
{"id": "0925b59b-1eef-4e03-a854-6903365001ef",(rest of the fields)},
{"id": "9c051494-9419-4643-b704-7871d9fee0f",(rest of the fields)}
],
(rest of the fields)

So Bubble understands its a dynamic number of clips in a list