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 {
        id
        title
        handle
        description
      }
    }
  }
`;
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": [
                {
                    "id": "section-id-1",
                    "title": "Section Title",
                    "handle": "section-title",
                    "description": "Section description"
                }
            ]
        }
    }
}

Was this page helpful?