Preview a change of template
Say what putting a contact on another template would do, without changing anything.
Call this before PUT /vaults/{vault}/contacts/{contact}/template and show the result to the person: it lists the answers that would go to Unused answers, the answers that would come back, and the reminders that would stop or run again. The change then does exactly what the preview says.
An answer follows the matching field of the new version, which is the field with the same key and type in the same section, or failing that the one such field anywhere else in the version. An answer without one is set aside, never deleted.
An answer or a reminder in a sensitive field is named only to a key holding the sensitive fields scope, because naming the field says that the contact has an answer there. Otherwise it is counted in hidden_count.
This endpoint answers GET and QUERY alike, and both return the same answer. GET sends the parameters in the address, QUERY in the request body. How QUERY works.
Parameters
Path parameters go in the address. GET sends the others in the address too, QUERY sends them as JSON in the request body. Anything not listed here is ignored.
The vault the contact lives in, named either by the readable name it reports as slug or by its id. Both answer.
The contact, named either by the readable name it reports as slug or by its id. Both answer. A readable name is rebuilt whenever the record is renamed, and the previous one stops answering, so a client that stores a reference stores the id. A name a record has released is never given to another. The contact has to be in the vault the path names: a contact of yours addressed through the wrong vault answers 404, the same as one that never existed. A contact absorbed by a merge answers 404 here, and the merge endpoints say what became of them.
The id of the template to preview, as GET /templates gives it.
A published version of that template. Leave it out to preview what the template publishes now.
Returns
What the change would do. Nothing is written. A vault, a contact or a template of another account answers 404, and so does a version that is not in your account. A template that describes another kind of record, is turned off, or has no published version, and a version that is not a published version of that template, each answer 422 with the reason on template.
What the change would do.
Always template_change_preview.
Everything the preview says.
False when the contact already uses that version, in which case every list is empty and the change would do nothing.
The version the contact uses now.
The id of its template. Null when that template was deleted.
What its template is called. Null when that template was deleted.
The id of the version.
Its number within its template, counting from 1.
The version the contact would use.
The id of its template.
What its template is called.
The id of the version, which is what the change takes as structure_version_id.
Its number within its template, counting from 1.
The fields whose answers would go to Unused answers, because the new version has no matching field. Nothing is deleted. An empty list when none would.
One field.
The id of the field the answers sit in now.
What the field is called.
The section the field belongs to.
How many answers of the contact it holds, more than one for a field repeated in a block.
The fields whose answers were set aside earlier and would come back, because the new version has a place for them. Same shape as set_aside.
One field.
The id of the field the answers sit in now.
What the field is called.
The section the field belongs to.
How many answers of the contact it holds.
The reminders that would stop, because the date they run on would go to Unused answers.
One reminder.
The id of the reminder.
What the reminder is called.
The reminders that would run again, because the date they run on would come back.
One reminder.
The id of the reminder.
What the reminder is called.
How many answers and reminders in sensitive fields the lists leave out, because the key does not hold the sensitive fields scope. Always 0 for a key that holds it.
Status codes
Every code the API answers with, and what the body holds when it does.
| Code | When | Body |
|---|---|---|
| 422 Unprocessable Content | With QUERY, a parameter was sent both in the address and in the body. | A message, and an errors object naming each parameter sent twice. |
Rate limit
Sixty requests per minute, per user, shared by every key and device. Every answer carries the budget left in X-RateLimit-Remaining.
Keys act as you, with exactly the access you have. Make one per integration so you can revoke it alone.