Back to Content Management API

articleRestore

Restores an article to a specific revision.

Arguments

  • Name
    id
    Type
    ID!
    Description

    The ID of the article you want to restore.

  • Name
    revisionId
    Type
    ID!
    Description

    The ID of the revision you want to use to restore.

Returns

  • Name
    Article.*
    Type
    Article
    Description

    Any requested field from the Article object.

Request

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

const query = `
  mutation ArticleRestore($id: ID!, $revisionId: ID!) {
    articleRestore(id: $id, revisionId: $revisionId) {
      id
      title
      handle
      description
      author
      category
      tags
      sections {
        nodes {
          id
          title
        }
      }
    }
  }
`;
const variables = {
    "id": "1",
    "revisionId": "1"
};
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);

Response

{
    "data": {
        "articleRestore": {
            "id": "article-id-1",
            "title": "Article Title",
            "handle": "article-title",
            "description": "Article description",
            "author": "Author Name",
            "category": "Category Name",
            "tags": [
                "tag1",
                "tag2"
            ],
            "sections": {
                "nodes": [
                    {
                        "id": "section-id-1",
                        "title": "Section Title"
                    }
                ]
            }
        }
    }
}

Was this page helpful?