How to prevent a records from being returned in response to a Web Service call if they have been sent in the previous call?
@RestResource(urlMapping='/Demo/*')
global class DemoController {
// GET REQUEST
@HTTPGET
global static List<Account> getRecords (){
List<Account> demoRecords = [Select ID, name, ........
FROM Account
WHERE... ];
}
}
When I first call this GET METHOD from POstman, say it returns 5 records.
Now, within 5 minutes, 2 more records got inserted in Salesforce.
After 5 minutes when i call this webservice again, I want only the 2 records to be returned by the webservice.
My idea is to create a field call 'Sent To External App'. when the external app calls the webservice, it should only get the records from SF, where 'Sent To External App' is false.
What I am no understanding is, how to make the ''Sent To External App' true after record was sent in the 1st call.