563848e0ecc0
Finalize a template by generating its validation schema
Completes the legacy three-step template flow: generates the JSON validation schema from the submitted field mappings (honoring the tenant-specific schema, when one is configured), uploads it to GCS as schema.json, and moves the template record to status success with its template/schema object paths recorded.
When to use: Call this as step 3 of the legacy flow, after PUT /templates/{id} has confirmed the column mappings. Templates created via POST /templates/single-step or the scratch builder are already approved and must not go through this endpoint.
How: Supply {id} and the required tenant-id header. The body is required and is not merely re-validated: the submitted fields are the direct input to schema generation, so send the same mappings confirmed in step 2. The same validation rules as PUT /templates/{id} apply - every stored CSV column must be mapped and every non-skipped mappedKey must be a known system field (400 otherwise), and a GROUP jobType requires the tenant's supportGroupRosters configuration.
Returns: An ApproveTemplateResponse with the fields the schema was generated from and the final status: success on completion, or failure when schema generation or upload failed with an I/O error - in that case the template record is left unchanged (it remains in-progress) and the call can be retried.
Path parameters
Server-generated ID of the template to approve, as returned by POST /templates.
Headers
Tenant that owns the template; scopes all reads and writes.
Request body
Example request
{
"fields": [
{
"name": "First Name",
"mappedKey": "firstName",
"mappedEntity": "practitioner",
"entityGroup": "license",
"validationRegex": "^\\d{10}$",
"separator": ";"
}
]
}Response
The mappings the schema was generated from and the final approval status. Note that failure is reported with HTTP 200 - check the body's status, not just the status code.
Example response
{
"fields": [
{
"name": "First Name",
"mappedKey": "firstName",
"mappedEntity": "practitioner",
"entityGroup": "license",
"validationRegex": "^\\d{10}$",
"separator": ";"
}
],
"status": "success"
}