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"
  });
  
  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.

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.

Errors

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