Identify the end sequence in a "bunch" of PATCH requests


#1

We have a resource for applying software license keys called ‘licenses’. For this example the ‘licenses’ resource contains a license Key and a person’s name.

"attributes": {
	"name": "",
	"licenseKey": "138-882-666"
}

The HTML form on the front end of the website contains a list of all the licenses and an input field for the name. This is acquired with a GET licenses collection request. When this form is submitted we PATCH one resource at a time. As per JSON API Spec we are not sending a collection of PATCH requests.

We need to identify the end of this set of PATCH requests in order for the server to send an email.

If there are 100 license and you are PATCHING 25 license, when the last in that set of 25 is sent and saved to the DB the server needs to send an email. The problem is that we send 1 PATCH requests at a time. There is no way for the Server to know that there are 25 of them in total or when we hit the end of the set of 25.

Right now we are looking at a couple of options.

-1. A meta data flag, to send an email that would only be submitted on the last PATCH request.

"meta": {
	"sendLicenseEmail": (bool) "true" OR "false"
}

-2. A meta data total that would include the total number of Patches being sent in this set of PATCH requests.

"meta": {
	"count": 25
}

I’m looking for some options & opinions on how other developers have handled this issue in the past.
Thanks All.