Delete Objects

Introduction

Getting objects is handled by the delete<Object Name> mutation. For example: deleteEpisode. For convenience in this document, this mutation will be generalised as deleteObject.

As well as deleting entire objects, you can also delete different parts of an object, specifically:

  • A language
  • A specific language version
  • A specific global version

The delete episode query returns a array of object deletion objects:

[
  {
    "uid" # The affected UID
    "language" # The affected language
    "language_version" # The deleted language version
    "global_version" # The deleted global version
    "messages" # Any additional message
  }
]

For each object in the array:

  • If the language attribute is returned and the language_version is null then the entire language has been deleted

  • If the language attribute and language_version attribute is returned then a specific language version has been deleted

  • If the global_version attribute is returned then a specific global version has been deleted

Delete Entire Object

By passing the UID as the only argument the entire object with all its languages, versions and field config will be deleted.

mutation deleteEpisode {
  deleteEpisode(uid: "4220f2b2-db6c-4c26-b870-204066bf534a") {
    uid
  }
}

Response:

[
  {
    "uid": "4220f2b2-db6c-4c26-b870-204066bf534a"
  }
]

Delete Specific Language Version

By passing UID, a language and a language_version arguments a specific language version will be deleted.

📘

The active version of a language cannot be deleted and would need to be changed first. If attempting to delete an active language version a DeleteException will be returned.

mutation deleteEpisode {
  deleteEpisode(
    uid: "4220f2b2-db6c-4c26-b870-204066bf534a",
    language: "en-GB",
    language_version: 1
  ) {
    uid,
    language,
    language_version
  }
}

Response:

[
  {
    "uid": "4220f2b2-db6c-4c26-b870-204066bf534a",
    "language": "en-GB",
    "language_version": 1
  }
]

Delete Specific Global Version

By passing UID and global_version arguments a specific global version will be deleted.

The active version of a global cannot be deleted and would need to be changed first. If attempting to delete an active global version a DeleteException will be returned.

mutation deleteEpisode {
  deleteEpisode(
    uid: "4220f2b2-db6c-4c26-b870-204066bf534a",
    global_version: 1
  ) {
    uid,
    global_version
  }
}

Response:

[
  {
    "uid": "4220f2b2-db6c-4c26-b870-204066bf534a",
    "global_version": 1
  }
]

Delete Multiple Objects

Its also possible to delete both a specific language version and specific global version in a single request by passing the UID, language, language_version and global_version at once.

If either the language version or global version are active the delete will fail and a DeleteException will be returned.

mutation deleteEpisode {
  deleteEpisode(
    uid: "4220f2b2-db6c-4c26-b870-204066bf534a",
    language: "en-GB",
    language_version: 1,
    global_version: 1
  ) {
    uid,
    language,
    language_version,
    global_version
  }
}

Response:

[
  {
    "uid": "4220f2b2-db6c-4c26-b870-204066bf534a",
    "language": "en-GB",
    "language_version": 1
  },
  {
    "uid": "4220f2b2-db6c-4c26-b870-204066bf534a",
    "global_version": 1
  }
]