How to use 'Edit Raw Data' functionality in the API Connector

Hi all - I want to modify the JSON response I’m getting back from an API but the Edit Raw Data functionality is confusing me.

I have this:

And I want something more like this:

Where I can take the two items returned in a list as ‘keys’ and name them, so the 1st one is “keyword” and the second one is “URL” but as the editor won’t even let me save this I’m obviously doing something wrong. Is this a syntax problem or am I trying to do something that simply can’t be done this way? In short, I need a way of editing the JSON response I get back from the API so I can more easily target those Keys.

In a perfect world, I’d want the JSON to look more like this:

  "rows": [
      "keyword": "search term 1",
      "URL": "",
      "clicks": 24,
      "impressions": 54,
      "ctr": 0.4444444444444444,
      "position": 2.037037037037037
      "keyword": "search term 2",
      "URL": "",
      "clicks": 17,
      "impressions": 107,
      "ctr": 0.1588785046728972,
      "position": 2.663551401869159

You cant. The response you manually enter in API response must fit the body returned by API.
But Im not sure to understand your real issue around this. If the API always return keywords as the first item in array and the url as second, why this is an issue for you?

I discovered a way using POSTMAN. Set what you want in a PAYLOAD and initialize Bubble API.
By what I saw, there is no way to set it manually in Bubble (it is not allowed).

Hi @Jici It just seems to cause me issues in numerous places. For example:

I am outputting the data from the API in an RG that looks like this in the front end:

And like this in the backend:

If I want a user to be able to sort those columns A-Z, Z-A, I can do that on any data that is not one of those ‘keys’ like this:

But when I try and do it on one of the keys e.g. the first item (which is keyword/query) or the last item (which is the url/page), then I get an error:

Hi @augusto1 could you explain the Postman/Payload route a bit more for me please.

I understand what you mean now and why this create issue with sorting.
Some idea I can see:
A) Create a plugins. But honestly, this is complex. Output an object for server-side/client-side
B) Create Two API Call. One will get data as text (what you actually get). Action will transform the payload to fit the one you want and output a json file (using a plugin like : Generate and Download Files Plugin | Bubble)
The second API Call will do a GET request to the created file url
C) Use another tool like Integromat. You have one API Connector that call Integromat endpoint, Integromat call the API you want, transform the JSON payload and return it at the end


Thanks for this. Agree something like Integromat is probably the easiest solution but I was trying to avoid that route but it might work for me short term.
I did sort of try option B - I returned the data from the API as text and then I used the Simple JSONata plugin to transform it to the format I wanted (which worked) but then I got a bit lost as to how I work with that transformed data. Maybe I’ll have another play with that route.