Sign inGet Started

Discard a language's draft edits back to its submitted copy

POST
/v1/whatsapp/templates/{template_ref}/versions/{version_id}/languages/{language}/discard
const restored = await bird.whatsapp.templates.versions.languages.discard(
  "order_update",
  "wav_01krdgeqcxet5s7t44vh8rt9mg",
  "en",
);
console.log(restored.language, restored.revision);
प्रतिक्रिया200
{
  "language": "pt-BR",
  "revision": 4,
  "content_hash": "sha256:9f2c4e1a7b03d85fbc6e29d417a05e8c3b1d9f76a2e4c018d53b7f9a6c2e18d4"
}

Restores one language of the template's draft to the copy the draft was branched from, discarding the edits made to it since. Only that language moves: every other language in the draft is left alone, which is what discarding the whole draft does not give you. A language the draft added, and a template that has never been submitted, have nothing to restore and are refused. Pass revision to make the discard a compare-and-set against the copy you read; omit it and the discard is last-write-wins, the same rule this language's PUT follows. Nothing reaches WhatsApp until the draft is submitted.

पैरामीटर

template_refstring

The template: its id (wat_…) or its slug. A value that parses as a wat_ id is treated as one; anything else is a slug. Slugs on this channel can spell a typed id, so the two are told apart by parsing the value rather than by its character set.

version_idstring

Version ID.

languagestring

The language, as a BCP-47 tag. Case and separator variance is accepted and normalised, and the canonical form is returned.

Request Payload

revision
integer

The revision you last read for this language, making the discard a compare-and-set: a mismatch is refused with a conflict, leaving an edit you have not seen in place. Omit it for last-write-wins, which is what a single writer wants. Supplying it for a language the draft no longer holds is also refused with a conflict rather than recreating the language.

Response Payload

language
string
आवश्यक

The canonical form of the tag you addressed. Use it in later calls for this language.

revision
integer
आवश्यक

The language's new revision, to pass back on your next write.

content_hash
string
आवश्यक

A hash over the content as saved, so you can tell whether your next write would change anything without diffing the document.

updated_at
string
आवश्यक

When this language was last written.

इस विषय के लिए दस्तावेज़, गाइड और उदाहरणों के साथ आगे बढ़ें।