Edit a story
Create a new version of a story with the storyEdit mutation, for example to replace its main asset with another file.
To edit a story, call the storyEdit mutation. It creates a new version of the story. You need the GraphQL ID of the story (see Get a story).
This example replaces the main asset with another file. Upload the file first, as in Post a story with a file, and use its token the same way.
The mutation:
mutation storyEditExample($input: StoryEditInput!) {
storyEdit(input: $input) {
story {
slug
version {
title
mainAsset {
__typename
... on FileAsset {
downloadUrl
embed
mimetype
filesize
}
}
}
}
errors {
__typename
... on MutationError {
path
}
}
}
}
The variables:
{
"input": {
"id": "STORY_ID",
"addedAssets": [
{
"type": "FILE",
"file": ".eJw...xMWA",
"uuid": "GENERATED_UUID"
}
],
"mainAsset": "GENERATED_UUID",
"title": "My story with a new file as main asset",
"publish": true
}
}
Most fields you leave out keep the value of the previous version. lang is the exception: a version sent without it has no language attached.
With publish: true, version in the response is the new version. With publish: false, version still returns the last published version, and the draft is in story.editVersion.
title,body,attributesandlangset the content of the new version.bodytakes aformatand amarkup, as in Post a story.addedAssetsandremovedAssetschange the attachments;mainAsset,coverAsset,removeMainAssetandremoveCoverAssetchange the main asset and the cover.addedTags,removedTags,addedHashtagsandremovedHashtagschange the tags. To change only the tags, use the simpler mutation in Change the tags of a story.publishisfalseby default, which saves the new version as a draft.commentdescribes the change in the version history.