Skip to main content

Standard Interface

fetchPost

This method allows you to retrieve a post data.


try {
  const workflowId = await linkedapi.fetchPost.execute({
    postUrl: "https://www.linkedin.com/posts/username_activity-id",
    retrieveComments: true,
    retrieveReactions: true,
    commentsRetrievalConfig: {
      limit: 20,
      replies: true,
      sort: 'mostRecent'
    },
    reactionsRetrievalConfig: {
      limit: 50,
    },
  });
  
  const { data, errors } = await linkedapi.fetchPost.result(workflowId);
  
  // The list of possible execution errors is below
  if (errors && errors.length > 0) {
    console.warn('Workflow completed with execution errors:');
    errors.forEach(error => {
      console.warn(` - Type: ${error.type}, Message: ${error.message}`);
    });
  }
  
  // The structure of the 'data' object is below
  if (data) {
    console.log('Workflow completed successfully. Data:', data);
  }
} catch (e) {
  // A list of all critical errors can be found here:
  // https://linkedapi.io/sdks/handling-results-and-errors/#handling-critical-errors
  if (e instanceof LinkedApiError) {
    console.error(`Critical Error - Type: ${e.type}, Message: ${e.message}`);
  } else {
    console.error('An unexpected, non-API error occurred:', e);
  }
}

# Python SDK is coming soon!
#
# You can always use Linked API through HTTP
# https://linkedapi.io/docs/

// Go SDK is coming soon!
//
// You can always use Linked API through HTTP
// https://linkedapi.io/docs/

Params

  • postUrl –  LinkedIn URL of the post.
  • retrieveComments (optional) – when set to true, includes comments made by the person in the results.
  • retrieveReactions (optional) – when set to true, includes reactions/likes given by the person in the results.
  • commentsRetrievalConfig (optional) – configuration for retrieving comments. Available only if retrieveComments is true.
    • replies (optional, default: false) – when set to true, the action includes replies to the comments in the results.
    • limit (optional) – number of comments to retrieve. Also applies to the replies if replies set to true. Defaults to 10, with a maximum value of 500.
    • sort (optional, default: mostRelevant) – enum representing comments sorting. Options:
      • mostRelevant – show most relevant comments first.
      • mostRecent – show most recent comments first.
  • reactionsRetrievalConfig (optional) – configuration for retrieving reactions. Available only if retrieveReactions is true.
    • limit (optional) – number of reaction to retrieve. Defaults to 10, with a maximum value of 1000.

Data

  • time â€“ timestamp when the post was published.
  • type â€“ type of the post. Enum with possible values:
    • original â€“ for original posts.
    • repost â€“ for reposts.
  • repostText â€“ additional text added during repost, if applicable.
  • text â€“ text content of the post, if available.
  • images â€“ array of top 3 preview image URLs, if available.
  • hasVideo â€“ boolean indicating if the post contains a video.
  • hasPoll â€“ boolean indicating if the post contains a poll.
  • reactionsCount â€“ number of reactions on the post.
  • commentsCount â€“ number of comments on the post.
  • repostsCount â€“ number of reposts on the post.
  • comments – array of post comments (included only if retrieveComments is true).
    • commenterUrl â€“ public URL of the person or company.
    • commenterName â€“ full name of the person or company.
    • commenterHeadline â€“ headline of the person or company.
    • commenterType – commenter type. Enum with the following values:
      • person – commenter is a person.
      • company – commenter is a company.
    • time â€“ free-form string indicating comment time. For example: 6d, 2w or 1y.
    • text â€“ text content of the comment, if available.
    • image â€“ URL of the comment's image, if available.
    • isReply – boolean value indicates if this comment is a reply to another comment.
    • reactionsCount â€“ number of reactions on the comment.
    • repliesCount â€“ number of replies on the comment. Always returns 0 if isReply is true.
  • reactions –  array of post reactions (included only if retrieveReactions is true).
    • engagerUrl â€“ URL of the person or company.
    • engagerName â€“ full name of the person or company.
    • engagerHeadline â€“ headline of the person or company.
    • engagerType – the engager type. Enum with the following values:
      • person – the engager is the person.
      • company – the engager is the company.
    • type – enum describing the reaction type. Possible values:
      • like â€“ standard "like".
      • celebrate â€“ to celebrate an achievement.
      • support â€“ to show support.
      • love â€“ to express love or admiration.
      • insightful â€“ to appreciate insightful content.
      • funny â€“ to react to something humorous.

Errors

  • postNotFound – provided URL is not an existing LinkedIn post.