Customize response when using insertMultiple Imprt Set API

User332204
Kilo Guru

Hi all,

 

I have started using the Import Set API and it seems nice so far, but really only for single records. I am using the insertMultiple part of it and that only returns this:

User332204_0-1669040604855.png

Compared to single which returns alot of information. The sender of the payload needs to recieve some form of feedback e.g the status of the row was it inserted or ignored etc? So if some fails they can resend only them instead of everything. 

1 ACCEPTED SOLUTION

User332204
Kilo Guru

Partly solved by taking the import_set_id and putting it in a table API. Like this:

/sys_import_set_row?sysparm_query=sys_import_set={sys_id of import set from payload response}%5Esys_transform_map%3D{sys_id of transform map if you have multiple and you only need response from one, in my case a userData transform map}&sysparm_display_value=true&sysparm_exclude_reference_link=true&sysparm_fields=sys_import_state_comment%2Csys_import_set%2Csys_import_state

View solution in original post

3 REPLIES 3

Tony Chatfield1
Kilo Patron

Hi, insertMultiple bulk inserts records into a temp staging\transform table.
Processing of the records into target table occurs asynchronously to the 'insert' and is not directly part of the insert process, so I would not expect any response other than a confirmation that the records were received.

If you need to process individual rows and return individual status messages then they should be sent as individual messages to the target table, or to a Scripted REST API end point.
I would recommend the scripted rest endpoint as you have better control over your data processing. 

Hi Tony,

 

I am aware, and I turned mine to run synchronously. I was using Scripted REST API up until now but it it's just the middle man right now. I rather have them write directly into the staging table, that's why I started looking into Import SET API. 

User332204
Kilo Guru

Partly solved by taking the import_set_id and putting it in a table API. Like this:

/sys_import_set_row?sysparm_query=sys_import_set={sys_id of import set from payload response}%5Esys_transform_map%3D{sys_id of transform map if you have multiple and you only need response from one, in my case a userData transform map}&sysparm_display_value=true&sysparm_exclude_reference_link=true&sysparm_fields=sys_import_state_comment%2Csys_import_set%2Csys_import_state