ScreenSteps

Updating article content through the API

Updated on

This article describes how to update article content via the API. Here are some important things to remember:

  • Currently you can only update text content. Replacing of images still needs to be done through the ScreenSteps web or desktop application.

All updates you make via the API will appear in Activity logs as if they were done by the user whose credentials are used when making the API calls.

1. Retrieve the article contents via the API

First, you will want to retrieve the article JSON via the API. You can see how to do that here:

How to retrieve article contents

You will want to look at the content_blocks key.

The content_blocks key will contain an array of content blocks. Each content block represents a block of content in your article.

Every content block will have a uuid, type and depth value.

The uuid value must be a version 4 (random) UUID.

The depth value will let you know if the block is at the top level of the document or if it is nested. All blocks at the top level will have a depth of 0.

The type will let you know what type of content block you are working with. These are the various types:

Content Block Type Values
StepContent title: string
content_block_ids: array
foldable: boolean
auto_numbered: boolean
depth: integer
TextContent body: string (html text)
style: string (introduction, info, alert, tip, or warning)
HtmlEmbedContent body: string (html text)
ImageContentBlock image_asset_id: integer
alt_tag: string
AttachmentContent file_asset_id: integer
CodeContent body: string
TableContent body: string

StepContent blocks are basically headings in your article. They can have various content_block_ids which represent all the child blocks for that step.

2. Modify the article JSON

If you simply want to modify the existing text of an article, you can modify the `content_blocks` JSON that you retrieve. If you want to add additional content blocks you just need to make sure that they have the values listed above.

3. Upload modified JSON via the API

Once you have modified the JSON data you can then create a POST request to:

/api/v2/sites/:site_id/articles/:article_id/contents
Click to copy

You should include the following JSON data:

{
  article: {
    title: "Article title",
    content_blocks: [
      { uuid: "ase4399s" type: "StepContent", title: "First step", depth: 0 }
    ],
    publish: true
  }
}
Click to copy

If you include a publish value of true then your updates will instantly be made live on your site. If you don't then a draft version of the article will be saved.

0 Comments

Add your comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Previous Article Creating Manuals, Chapters and Articles through the API
Next Article Why are the links to my images broken?
Still Need Help? Contact Us