Back to Content Management API

blogHistory

Returns array of all revisions for the blog by ID paginated by a cursor.

Arguments

  • Name
    id
    Type
    ID!
    Description

    The ID of the blog.

  • Name
    after
    Type
    String
    Description

    Returns the elements that come after the specified cursor.

  • Name
    before
    Type
    String
    Description

    Returns the elements that come before the specified cursor.

  • Name
    first
    Type
    Int
    Description

    Returns up to the first n elements from the list.

  • Name
    last
    Type
    Int
    Description

    Returns up to the last n elements from the list.

Returns

  • Name
    BlogRevisionConnection.edges
    Type
    [BlogRevisionEdge!]!
    Description

    A list of edges.

  • Name
    BlogRevisionConnection.nodes
    Type
    [BlogRevision!]!
    Description

    A list of the nodes contained in BlogRevisionEdge.

  • Name
    BlogRevisionConnection.blogInfo
    Type
    BlogInfo!
    Description

    Information to aid in pagination.

  • Name
    BlogRevisionConnection.totalCount
    Type
    Int
    Description

    The total count of items.

Request

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

const query = `
  query BlogHistory($id: ID!) {
    blogHistory(id: $id) {
    nodes {
      title
      handle
      description
      }
    }
  }
`
const variables = {
  id: 'blog-id'
}
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);

Response

{
    "data": {
        "blogHistory": {
            "nodes": [
                {
                    "title": "Blog Title",
                    "handle": "blog-handle",
                    "description": "Blog Description"
                }
            ]
        }
    }
}

Was this page helpful?