The CreatorCon Call for Content is officially open! Get started here.

REST Response problem - Too Large to handle

Abhinab Achary1
Tera Guru

Hi,

I have a REST API call that is returning JSON that is too big(> 35MB). Now I cannot use the response as usual 

response.getBody() as it will only support till 5 MB and max 10 if used a property.

So I have tried the request.saveResponseBodyAsAttachment(file). to store the large json. unitll here its storing and also getting attached to the record.

Now I need to read that file and do necessary action, while doing that I need to store that big content(> 35MB) atleast to a variable. Now SNOW do not allow string object above 32MB. 

Now what technique should I use for such cases where the whole content of the big file needs to be use to do processing (create / update ) record.

 

Thanks,

Abhinab

1 ACCEPTED SOLUTION

Hi,

there will be some limitations

I would suggest to get the response in chunks so that it becomes easier to parse in ServiceNow.

the maximum attachment size that the system will return for base64 encoding for is controlled by this system property

com.glide.attachment.max_get_size property.

If the setting does not exist it will default to maximum 5 MB.

You can change this standard value as per your need. However, as mentioned in the following KB, this may cause some issues.

Large attachments may cause Out Of Memory errors and performance degradation

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

15 REPLIES 15

@Abhinab Acharyya 

Thank you for marking my response as helpful.

If my response helped you please mark it correct to close the question so that it benefits future readers as well.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader