# Mautic Again - CANNOT GET DATA OUT

**URL:** <https://community.parabola.io/t/mautic-again-cannot-get-data-out/1835>\
**Category:** Ask a question\
**Tags:** Using-APIs\
**Created:** [June 2, 2021, 2:18pm UTC](https://community.parabola.io/t/mautic-again-cannot-get-data-out/1835 "2021-06-02T14:18:11Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tony\_Standing](https://avatars.discourse-cdn.com/v4/letter/t/df788c/32.png) [@Tony\_Standing](https://community.parabola.io/u/Tony_Standing)\
**Post date:** [June 2, 2021, 2:18pm UTC](https://community.parabola.io/t/mautic-again-cannot-get-data-out/1835/1 "2021-06-02T14:18:11Z")

</div>

Hi all,  
I have been quite successful in getting data into Mautic but I can not get it back out and into Parabola.  
I can link to it, and I can get the contacts, but the work around for the JSON Flattener etc no longer works and Mautic is trying to bring back over 5000 columns in a set.

Does anyone know what I am doing wrong?  
 ![M1](https://us1.discourse-cdn.com/flex020/uploads/parabola/original/2X/0/0127c150e4ff8d6075dfd99e615eb13cfc24f496.png)

---

<div class="post-metadata">

**Author:** ![Adam\_R](https://sea2.discourse-cdn.com/flex020/user_avatar/community.parabola.io/adam_r/32/2207_2.png) [@Adam\_R](https://community.parabola.io/u/Adam_R)\
**Post date:** [June 2, 2021, 4:39pm UTC](https://community.parabola.io/t/mautic-again-cannot-get-data-out/1835/2 "2021-06-02T16:39:32Z")

</div>

Hi Tony,

Happy to help! Did you try using the `Expand JSON` step? It can sometimes be helpful to use the `Clean Data` step before expanding your JSON to escape any characters making it more difficult to be flattened.

 ![Screen Shot 2021-06-02 at 9.42.01 AM](https://us1.discourse-cdn.com/flex020/uploads/parabola/original/2X/c/ca5fdddec673c6e64fa6e47b10820b48be2e2211.png)

If that does not work, would you mind please replying with a screenshot of the problem that you run into when trying that step? Thanks!

---

<div class="post-metadata">

**Author:** ![Tony\_Standing](https://avatars.discourse-cdn.com/v4/letter/t/df788c/32.png) [@Tony\_Standing](https://community.parabola.io/u/Tony_Standing)\
**Post date:** [June 2, 2021, 5:05pm UTC](https://community.parabola.io/t/mautic-again-cannot-get-data-out/1835/3 "2021-06-02T17:05:59Z")

</div>

Hi Adam,

Thanks for the help. I tried the clean data and it did nothing to help.

My issue is that I pull back data from Mautic, it the case below 23 records and in the contacts column, all the separate columns for the contacts.

![1622652839857020_1828450685.png](https://us1.discourse-cdn.com/flex020/uploads/parabola/original/2X/8/86a866c7270f3ac965904b3a41dd676e04a05905.png)

So I need to do a Json Flatten and a flip table and another import of the data and a table stack(or at least that is how I used to solve this issue) - I received this in the past from Parabola Help:

You can work around this problem by having two API Imports - one that takes care of the Header row and the other that has the row values:

1. First, I want you to duplicate your current API Import step so that you have two of them

2. For one of them (where the top level key is NOT selected), I want you to add a JSON Flattener step next to it and flatten the column “headers”. Please make sure you select “headers” in the dropdown to “Expand list into New Rows”

3. Then, put a Column Filter step where you select to KEEP “headers (1)”

4. Then add a Table Flip step. You’ll see that this creates a header row

5. Finally add another Column Filter step to REMOVE “headers (1)”

6. For the second API Import step, select “rows” for the top level key

7. Finally, use a Table Merge step. Connect the first branch where we’ve created the header row first and then the second API Import. Now, you’ll see that the Header row and the row values are neatly stacked on top of each other.

However, If I follow the above,

![1622653220418036_1828450685.png](https://us1.discourse-cdn.com/flex020/uploads/parabola/original/2X/c/cc706e98735d4f8f480f39ba7f260d5a580fd7c1.png)

Above is step 2

then step 3

![1622653276203009_1828450685.png](https://us1.discourse-cdn.com/flex020/uploads/parabola/original/2X/b/b96b3ee3611e86414b28a397b21c43475c15a266.png)

So,

I just cannot seem to get a set of columns with the data. If i do get further than the above, it says there are more than 5000 columns. Each record has 550 columns.

I just get nowhere with this!!!

Tony

---

<div class="post-metadata">

**Author:** ![Adam\_R](https://sea2.discourse-cdn.com/flex020/user_avatar/community.parabola.io/adam_r/32/2207_2.png) [@Adam\_R](https://community.parabola.io/u/Adam_R)\
**Post date:** [June 2, 2021, 10:47pm UTC](https://community.parabola.io/t/mautic-again-cannot-get-data-out/1835/4 "2021-06-02T22:47:43Z")

</div>

Hi Tony,

It appears that the JSON coming from the API is structured differently now than it was when our team provided that advice. In the screenshot you previously sent us, I can see columns titled ‘headers’ and ‘rows’, each containing JSON data. It now seems like headers and rows are being packaged in ‘contacts’, which should (hopefully) eliminate the need for multiple API import steps to bring in one contact.

Do you mind specifying exactly what your desired end result looks like?

In your `Expand JSON` step above, I can see that the JSON has been flattened into 1 row and 2,641 columns. After the `Flip Data` step, this should be 2,640 rows and 2 columns. Is this what you were hoping for?

Finally, have you considered using multiple API steps, and bringing in 1 ‘contacts’ object per API pull? Once you pull in, expand, and flip the data (which should be under 5000 rows if you do them one by one), you could then use a `Stack Tables` step to combine the data all into one larger sheet.

If you have API documentation that you’re able to pass along, that would also be helpful!

---

<div class="post-metadata">

**Author:** ![Tony\_Standing](https://avatars.discourse-cdn.com/v4/letter/t/df788c/32.png) [@Tony\_Standing](https://community.parabola.io/u/Tony_Standing)\
**Post date:** [June 3, 2021, 5:16am UTC](https://community.parabola.io/t/mautic-again-cannot-get-data-out/1835/5 "2021-06-03T05:16:18Z")

</div>

Hi Adam,I will update later although the solution you talk about is ok on this test of data. Once I pull all data, there can be half a million records and this I reach the 5000 column limits etc.  
Ideally I just want a table of data. Each record separate line with columns.  
I had assumed it would be fairly straightforward, nothing is with Mautic.  
I will update with API link soon.  
Thanks for the help  
Tony

---

<div class="post-metadata">

**Author:** ![Tony\_Standing](https://avatars.discourse-cdn.com/v4/letter/t/df788c/32.png) [@Tony\_Standing](https://community.parabola.io/u/Tony_Standing)\
**Post date:** [June 3, 2021, 6:13am UTC](https://community.parabola.io/t/mautic-again-cannot-get-data-out/1835/6 "2021-06-03T06:13:57Z")

</div>

Hi Adam,

The document link:

[Mautic Developer Documentation](https://developer.mautic.org/#rest-api)

Tony

---

<div class="post-metadata">

**Author:** ![Adam\_R](https://sea2.discourse-cdn.com/flex020/user_avatar/community.parabola.io/adam_r/32/2207_2.png) [@Adam\_R](https://community.parabola.io/u/Adam_R)\
**Post date:** [June 3, 2021, 11:46pm UTC](https://community.parabola.io/t/mautic-again-cannot-get-data-out/1835/7 "2021-06-03T23:46:08Z")

</div>

Thanks for sending that over, Tony! We took a look at this on our end, and it does not seem like our `Expand JSON` step is able to parse this data in a user-friendly way stemming from the JSON format returned by the API.

We are going to continue to look at this on our end and will keep you updated with what we find. Appreciate your patience, and please let us know any progress you’re able to make in the meantime!

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex020/user_avatar/community.parabola.io/daniel/32/732_2.png) [@daniel](https://community.parabola.io/u/daniel)\
**Post date:** [June 4, 2021, 7:37pm UTC](https://community.parabola.io/t/mautic-again-cannot-get-data-out/1835/8 "2021-06-04T19:37:08Z")

</div>

Hey @Tony_Standing,

Thanks for your patience here. Here’s a workaround that should help parse your data so that each contact exists in a separate row.

 ![JSON](https://us1.discourse-cdn.com/flex020/uploads/parabola/original/2X/d/d6e0606614f3422e570c973eb74a43d43536699b.png)

The main issue is that the API returned multiple contact objects, but they were not formatted in an array. This workaround will reformat your JSON with a single, top-level contact and put each contact in the array.

Feel free to copy and paste this snippet into your flow to copy the step and configuration settings pictured above:

`parabola:cb:1d0c6f07411b4f19ab076f5cf9329754`

Just be sure to add in your authorized API step, and you should be good. Hope that helps!

---

<div class="post-metadata">

**Author:** ![Tony\_Standing](https://avatars.discourse-cdn.com/v4/letter/t/df788c/32.png) [@Tony\_Standing](https://community.parabola.io/u/Tony_Standing)\
**Post date:** [June 4, 2021, 9:06pm UTC](https://community.parabola.io/t/mautic-again-cannot-get-data-out/1835/9 "2021-06-04T21:06:21Z")

</div>

Hi Daniel,

Many thanks for the help and yes that does indeed work to a fashion. If I remove the email filter the number of records increases and thus the find and replace no longer works as the value has changed in the data that is brought back. As the data and the data set is always expanding and contracting dependent on the number of records, I would need to make the find and replace a dynamic value, otherwise it will have to be manually changed every time the flow is run.

I hope that makes sense?

Changes to the URL parameters have effected the figures in the TOTAL.

 ![1622840701247002_178240417.png](https://us1.discourse-cdn.com/flex020/uploads/parabola/original/2X/e/ebce8dada24d731808dd89c57012f412fe8d07b8.png)

Can the find and replace on the 9032 be made dynamic for whatever is in the Total?

Best wishes

Tony

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex020/user_avatar/community.parabola.io/daniel/32/732_2.png) [@daniel](https://community.parabola.io/u/daniel)\
**Post date:** [June 5, 2021, 12:56am UTC](https://community.parabola.io/t/mautic-again-cannot-get-data-out/1835/10 "2021-06-05T00:56:18Z")

</div>

Hey @Tony_Standing ,

That makes sense. Try using this snippet instead:

`parabola:cb:9baeaecdc3a4456b933376a26a16fc99`

Instead of using the “Find and replace” step, the above snippet will separate your JSON body from the top-level key into a new column. From there, we can add another text column to dynamically merge the value in your `total` column to create a new key.

Lastly, we can merge the columns back together to get a formatted JSON blob.

Let me know if that helps!

---

<div class="post-metadata">

**Author:** ![Tony\_Standing](https://avatars.discourse-cdn.com/v4/letter/t/df788c/32.png) [@Tony\_Standing](https://community.parabola.io/u/Tony_Standing)\
**Post date:** [June 5, 2021, 5:14am UTC](https://community.parabola.io/t/mautic-again-cannot-get-data-out/1835/11 "2021-06-05T05:14:33Z")

</div>

Hi Daniel,

Many thanks again for all of your help. It seems it does not work. In the last step I get an error:

 ![1622870050114004_1388457365.png](https://us1.discourse-cdn.com/flex020/uploads/parabola/original/2X/1/165d497ffe5147049b8f52897f53051d3f9a1371.png)

There is no Formatted Json 23?

bw,

Tony

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex020/user_avatar/community.parabola.io/daniel/32/732_2.png) [@daniel](https://community.parabola.io/u/daniel)\
**Post date:** [June 7, 2021, 9:33pm UTC](https://community.parabola.io/t/mautic-again-cannot-get-data-out/1835/12 "2021-06-07T21:33:49Z")

</div>

Hi @Tony_Standing,

Ah, nice catch. This is likely a result of how the regex step is targeting the starting key for each object. Right now, it will target ids with exactly 4 numbers like `"9032":`.

This updated snippet has a better regex expression to capture all object ids (regardless of how many digits) and nests them into an array:

`parabola:cb:d69f63bb96cc4db1be114006af009ddc`

Let me know if that helps.
