Back to Content Management API

contentReleaseHasDraft

Returns true when the release contains a draft for the given content item.

Arguments

  • Name
    releaseId
    Type
    ID!
    Description

    The ID of the release.

  • Name
    contentType
    Type
    ContentReleaseDraftType!
    Description

    The type of content the draft belongs to: page, article, blog, product, collection, siteSettings, section, or template.

  • Name
    contentId
    Type
    ID!
    Description

    The ID of the content item.

Returns

  • Name
    Boolean!
    Type
    Boolean!
    Description

    Whether the release contains a draft for the content item.

Request

import { PackClient } from '@pack/client'
const packClient = new PackClient({
  token: 'YOUR-PACK-TOKEN',
})

const query = `
  query ContentReleaseHasDraft($releaseId: ID!, $contentType: ContentReleaseDraftType!, $contentId: ID!) {
    contentReleaseHasDraft(releaseId: $releaseId, contentType: $contentType, contentId: $contentId)
  }
`
const variables = {
  releaseId: 'release-id',
  contentType: 'page',
  contentId: 'page-id',
}
const response = await packClient.fetch(query, { variables })
console.log(response.data)

Response

{
  "data": {
    "contentReleaseHasDraft": true
  }
}

Was this page helpful?