Skip to main content
Any user associated with a context with AUTHENTICATED scope can execute createPost mutation. The current API user will be set as an author. A content such as a learning path or a certificate can be shared. If the provided content doesn’t relate to the current API user, it will be skipped, and a post will be created only with the text. Mutation has a single required incoming argument - data that represents PostCreationInput object:
ParameterTypeDescription
textStringRequired. The post body text. Available HTML tags are: <a>, <p>, <br>. Any other tag will be trimmed.
sharedContentPostSharedContentInputOptional. Contains the data related to the content that is going to be shared in the post (learning path or a certificate).
imagesBase64[UploadedFileInput]The list of post images, each one should be formatted as base64 string. Up to 10 images can be shared, max file size - 20Mb. Allowed extensions: png, jpg, jpeg, gif. Leave empty to not attach any images to the post. Warning: once the post was created, this property cannot be updated.
filesBase64[UploadedFileInput]The post files, each one should be formatted as base64 string. Up to 10 files can be shared, max file size - 20Mb. Allowed extensions: txt, pdf, doc, docx, xls, xlsx, ppt, pptx, svg. Leave empty to not attach any files to the post. Warning: once the post was created, this property cannot be updated.
communityIdIDShould be filled if the post relates to a community. Leave empty to create a regular post. In case if it’s filled, the created post will be visible not only to the current user’s network, but to all members of the given community. Warning: once the post was created, this property cannot be updated.

PostSharedContentInput object

ParameterTypeDescription
contentIdIDRequired. ID of the shared content (a learning path or a certificate).
contentTypePostSharedContentTypeRequired. Contains the type of the shared content. Available options: LEARNING_PATH or CERTIFICATE.
The list of certificates available for sharing can be retrieved by calling getPaginatedUserCertificates query. To get the list of learning paths (trainings) available for sharing, the getTrainingsForSharing query should be called.

UploadedFileInput object

Represents an input data to upload a new file through the API.
ParameterTypeDescription
filenameStringRequired. A name of the file that should be created. Available file extensions depend on the entity that should be created.
contentBase64StringRequired. File content formatted as a base64 string. The limit for the file upload is 20 Mb (or the limit that is set for the file upload on the server, if it’s less than 20 Mb).

An example of a post creation

  mutation createPost {
    createPost(data: {
      text: "This is a dummy post text",
      sharedContent: {
        contentId: 69,
        contentType: LEARNING_PATH
      }
    }) {
      response {
        id
        text
        created
        authorUserContext {
          id
          uuid
        }
        sharedContent {
        id
        type
        title
        description
        earnedOn
          image {
            alt
            title
            url
          }
        }
        cta {
          actionId
          title
          arguments {
            key
            value
          }
        }
      }
      errors
    }
  }
The mutation returns a Post object. Detailed description and the full list of available properties can be found here.
I