Back to Content Management API

articleHistory

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

Arguments

  • Name
    id
    Type
    ID!
    Description

    The ID of the article.

  • 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
    ArticleRevisionConnection.edges
    Type
    [ArticleRevisionEdge!]!
    Description

    A list of edges.

  • Name
    ArticleRevisionConnection.nodes
    Type
    [ArticleRevision!]!
    Description

    A list of the nodes contained in ArticleRevisionEdge.

  • Name
    ArticleRevisionConnection.articleInfo
    Type
    ArticleInfo!
    Description

    Information to aid in pagination.

  • Name
    ArticleRevisionConnection.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 ArticleHistory($id: ID!) {
  articleHistory(id: $id) {
  nodes {
    title
    handle
    description
    }
  }
}
`
const variables = {
  id: "0190cc74-7ecf-7e07-a9be-faa85c92f7c4",
}
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);

Response

{
    "data": {
        "articleHistory": {
            "nodes": [
                {
                  "title": "Article Title",
                  "handle": "article-handle",
                  "description": "Article description."
                }
            ]
        }
    }
}

Was this page helpful?