API - Post - Error when posting data

I got the below error:

the column is PhoneNumber - do I need to transfrom it somehow?

Yes! Something like this:

{{ PostTo121ProData.data.data.map(({number, result}) =>({PhoneNumber: number, result:result})) }}

should work?

1 Like

And just like that...it works!!!

If there any way of getting the valid_until value from 121ProData and use this as part of the insert so we can get the ExpiryDate part populated on the table too?

Thank you so much for all your support. You don't realise how much I appreciate this.

Always happy to help :slight_smile:

Could you try this? Note: I’m on mobile and walking to my train home, so I haven’t fact-checked my work :sweat_smile:

{{ PostTo121ProData.data.data.map(({number, result}) =>({PhoneNumber: number, result:result, ExpiryDate: PostTo121ProData.data.valid_until})) }}

1 Like

Hi Victoria,

Sorry for the delay in my reply.

The above worked fine, with a minor edit to the date format, so good work whilst walking to your train home! :laughing:

I have been working through an issue today on this project, now that the above worked - I tested it with a large volume of data. Whilst it works, there is an issue with the Bulk Insert function having too many parameters, so I will need to 'batch' the uploads.

I have been testing this:

const batchSize = 50;
const batchedData = _.chunk(DataPreview.data, batchSize);
batchedData.forEach(databatch => BulkInsert.trigger({additionalScope: {databatch}}));

which works, but I need it to trigger onSuccess: DateClean.trigger();

after the last batch has been completed. I am trying to work out how to make it only trigger this DateClean query after the last batch has been processed.

Any guidance would be greatly apprecaited.

Many thanks,

Michael.

Hey Michael! Top of the morning :sun_with_face:

What about an On Success event handler attached to your batch query?

Hi Victoria,

Got it, I've made it dynamic based on the number of rows and it's working as expected.

Thank you again for all your and Dave's support. You've both been great!

Have a nice day! :slight_smile:

2 Likes