Get next IDs for site

GET /api/configuration/system/sites/{id}/next-ids

Success: 200 OK

Overview

Returns the 23 sequence counters a site uses to allocate its own record numbers — the next booking ID it will issue, the next member ID, the next invoice number and so on. Each counter is a system-configuration setting held against the site, and this endpoint reads them all in one call and returns them as integers.

This is a read, not an allocation. Calling it does not reserve a number or advance any counter, and two callers reading at the same moment see the same values. Do not use it to generate identifiers of your own — the platform advances these counters itself as records are created, and a number you read here will very likely be taken by the time you try to use it. Its legitimate uses are inspection and reconciliation: confirming a site has been provisioned, checking that counters are where a data migration left them, or reading current values before writing new ones with the matching PUT.

Two things catch integrators out:

Note also that these counters are only meaningfully per-site when the operator has the Database_EnableSiteSpecificIDs configuration switched on. Reads always work regardless; it is the corresponding update that is rejected when the switch is off.

Endpoint

GET {base_url}/api/configuration/system/sites/{id}/next-ids

{base_url} is the environment URL issued to your integration. See Authenticating with Gladstone APIs.

Path parameters

NameTypeRequiredDescription
idstringYesThe site whose counters you want — a site ID, despite the generic parameter name. Take it from the id of a site returned by Get site by ID. A site ID with no matching configuration settings returns 404; the endpoint does not verify that the site itself exists, so an unknown site and an unprovisioned one are indistinguishable.

Sample request

cURL
curl -X GET '{base_url}/api/configuration/system/sites/{id}/next-ids' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true'

Response fields

Every field below is the value the site will use next, read from the identically named system-configuration setting on that site. All start at 1 when a site is created, except nextDirectDebitDate, which starts empty. A counter whose value is an empty string is returned as 0; a counter whose value is not an integer fails the whole request with 422.

FieldTypeDescription
nextAccompaniedAttendanceinteger (int32)Next sequence number for an accompanied-attendance record — the attendance record created when a member brings a child or dependant in with them, which carries the child's name and ID alongside the member's.
nextBookingIDinteger (int32)Next booking record number for the site. Counted separately from nextBookingRef.
nextBookingRefinteger (int32)Next booking reference the site will issue, counted separately from nextBookingID.
nextCancellationRefinteger (int32)Next cancellation reference the site will issue.
nextCorrespondenceIDinteger (int32)Next record number for a correspondence record at this site.
nextDirectDebitDateinteger (int32)Returned as 0 on any site that has not had a value set.
nextEFTRunIDinteger (int32)Next run number for an EFT (electronic funds transfer) batch — the collection run the site submits to its configured EFT system, whose bank details you can read with Get site bank accounts by EFT system ID.
nextEFTTransactionIDinteger (int32)Next record number for an individual EFT transaction, counted separately from the run number in nextEFTRunID.
nextEventLogIDinteger (int32)Next record number for an event log entry at this site.
nextInvoiceIDinteger (int32)Next invoice number for the site, counted separately from nextSalesInvoiceID.
nextMailIDinteger (int32)Next record number for a mail record at this site, counted separately from nextCorrespondenceID.
nextMemberActionIDinteger (int32)Next record number for a member action record at this site.
nextMemberIDinteger (int32)Next member number the site will allocate. Reading it does not reserve it — the platform advances this counter itself when a member is created, so never use the value here as the member ID for a member you are about to create.
nextOnlineAuthIDinteger (int32)Next record number for an online authorisation at this site. Sites carry a matching set of OnlineAuth* settings covering an account ID, fund code and fund name, so this counter numbers records in that online authorisation feature.
nextProductReferenceIdinteger (int32)Next product reference number for this site.
nextSalesInvoiceIDinteger (int32)Next sales invoice number for the site, counted separately from nextInvoiceID. Note that a related NextTempSalesInvoiceID setting exists on every site — starting at -1 rather than 1 — but is not returned by this endpoint and has no field here.
nextSalesReceiptIDinteger (int32)Next sales receipt number for the site, counted separately from nextSalesInvoiceID.
nextSubscriptionRefinteger (int32)Next subscription reference the site will issue.
nextTerminalReadingIdinteger (int32)Next record number for a terminal reading. Readings are till totals recorded against a site, a user and a run date; terminal, X and Z are three of the seven reading types the platform records, and each of the three has its own counter here.
nextUserReadingIdinteger (int32)Next record number for a user reading.
nextWaitinglistRefinteger (int32)Next waiting list reference the site will issue.
nextXReadingIdinteger (int32)Next record number for an X reading, one of the till reading types the platform records, counted separately from Z readings.
nextZReadingIdinteger (int32)Next record number for a Z reading, counted separately from nextXReadingId. The platform distinguishes plain Z readings from auto-Z and reprint-Z readings, but all draw on this one counter.

Sample response

200 OK
{
  "nextAccompaniedAttendance": 1,
  "nextBookingID": 12345,
  "nextBookingRef": 1,
  "nextCancellationRef": 1,
  "nextCorrespondenceID": 12345,
  "nextDirectDebitDate": 1,
  "nextEFTRunID": 12345,
  "nextEFTTransactionID": 12345,
  "nextEventLogID": 12345,
  "nextInvoiceID": 12345,
  "nextMailID": 12345,
  "nextMemberActionID": 12345,
  "nextMemberID": 12345,
  "nextOnlineAuthID": 12345,
  "nextProductReferenceId": 12345,
  "nextSalesInvoiceID": 12345,
  "nextSalesReceiptID": 12345,
  "nextSubscriptionRef": 1,
  "nextTerminalReadingId": 12345,
  "nextUserReadingId": 12345,
  "nextWaitinglistRef": 1,
  "nextXReadingId": 12345,
  "nextZReadingId": 12345
}

Errors

StatusMeaningWhen
404Not foundNo system-configuration settings whose key contains next exist for that site ID — the site has never been provisioned, or the ID does not exist. The body is the plain-text string System configuration with the site id {id} could not be found.
422Unprocessable entityThe site has some next-ID settings but not all 23 the response requires, or one of them holds a value that is not an integer. Both cases fail the whole call — you never receive a partial object. The response body is empty, so the offending key is not reported to you; if you hit this, compare the site's settings against a known-good site.
500Internal server errorAny other unexpected server-side failure. The response body is empty.

This page as markdown · All pages · llms.txt