Start a conversation

Updating a Guide

To update the guide title, description, and avatar, use the updateGuide mutation.

Fields

Use the below fields to update a guide.

Field Description Required
id Guide ID where you want to update the fields Required
title The guide title Optional
description The guide description Optional
avatar Avatar of the guide. This includes file and cropProps sub-fields Optional
file This is a sub-field of avatar. The guide image you want to update Optional
cropProps This is a sub-field of avatar. The crop properties of the avatar that includes positionX, positionY, relativeWidth, relativeHeight, scale, relativeX, and relativeY fields for the image Optional
hidden To hide a guide from members, set this field as false. By default, the guides are hidden.
To finalize your KB Guide structure and all the articles in it, you can hide the KB guide from the members by setting this field as true.
Optional

Example

To update the guide title and description from “People Choice” and “People Choice on New Government” to “Leaders Choice” and “Leaders Choice on New Government” respectively, add an avatar using a file, and unhide a guide, use the updateGuide mutation as a form-data request.

Breakdown of the Request

Use a GraphQL request with a form-data body type to update the guide information with the mutation.

Form-data Parameter Description
operations This parameter has the updateGuide mutation. This mutation contains the fields, mapping information, and variables.
map This parameter maps the mutation with the attached file.
file This parameter adds the image file from your machine to the request.

Operations Parameter Value

{
  "operationName": "UpdateGuide",
  "variables": {
    "file": {
      "avatar": {
        "file": null,
        "cropProps": {
          "positionX": 0.5,
          "positionY": 0.5,
          "relativeWidth": 0.5,
          "relativeHeight": 1,
          "scale": 1,
          "relativeX": 0,
          "relativeY": 0
        }
      },
      "id": "guide:600",
      "title": "Leaders Choice",
      "description": "Leaders Choice on new Government.",
      "hidden": false
    }
  },
  "query": "mutation UpdateGuide($file: UpdateGuideInput!) {\n  updateGuide(updateGuideInput: $file) {\n    errors {\n      __typename\n    }\n    __typename\n  }\n}\n"
}

Map Parameter

{"1":["variables.file.avatar.file"]}

File Parameter

"/Users/[USERNAME]/Downloads/wing.png"

Curl Request

Update a Guide with an avatar

curl -L 'https://[COMMUNITY DOMAIN]/t5/s/api/2.1/graphql' \
-H 'li-api-session-key: 1111222233334444555AAAABBBCCCDDD.' \
-H 'Content-Type: multipart/form-data' \
-F 'operations="{\"operationName\":\"UpdateGuide\",\"variables\":{\"file\":{\"avatar\":{\"file\":null,\"cropProps\":{\"positionX\":0.5,\"positionY\":0.5,\"relativeWidth\":0.5,\"relativeHeight\":1,\"scale\":1,\"relativeX\":0,\"relativeY\":0}},\"id\":\"guide:600\",\"title\":\"Leaders Choice\",\"description\":\"Leaders Choice on new Government.\",\"hidden\":false}},\"query\":\"mutation UpdateGuide(\$file: UpdateGuideInput\!) {\\n  updateGuide(updateGuideInput: \$file) {\\n    errors {\\n      __typename\\n    }\\n    __typename\\n  }\\n}\\n\"}"' \
-F 'map="{\"1\":[\"variables.file.avatar.file\"]}"' \
-F '1=@"/Users/[USERNAME]/Downloads/Icon.png"' \

Update a Guide without an avatar

mutation {
    updateGuide(updateGuideInput: {id: "guide:601", title: "Opinion of Different Companies", description: "This guide is about different companies", hidden: false }) {
        errors {
            __typename
        }
    }
}

Curl Response

{
  "data": {
    "updateGuide": {
      "errors": null
    }
  }
}
Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. ATLAS

  2. Posted
  3. Updated

Comments