I'm making integration to an external system and send them a request, and I get a JSON as a response via REST API.
The response has a lot of data to upsert to SF.
While upserting the Data inside the response - I want to validate the data.
After doing so, I want to send all the data that didn't pass the validation.
My question is - Do I need to have another request? Or can I use the response to send another data? (Like make the connection open)
Http h = new Http(); HttpRequest httpReq = new HttpRequest(); httpReq.setMethod('POST'); httpReq.setHeader('Content-Type','application/json'); httpReq.setEndpoint('Some URL'); httpReq.setBody('body'); HttpResponse res = h.send(httpReq); //! GET the JSON HERE RootObject data = (RootObject) JSON.deserialize(res.getBody(), RootObject.class); Map<String,String> errorsMap = ValidateData(data); //Send the errorsMap (Keyset and Values to the external System again). //Do I need to create another request to it? - Means use the Http send method twice?