Perform posts search
Learn how to search for posts on LinkedIn using Unipile API.
Unipile offers two methods tu run a search :
- With filters : you provide any combination of parameters directly in the method body. E.g. : keywords, date_posted, author, etc.
- From URL : you provide the URL of a LinkedIn native search so the filters can be automatically infered.
Note about Search ParametersMany of the search filters on LinkedIn work with IDs that reference parameters, rather than the parameters themselves.
For example, in the
posted_by[member]filter, you cannot directly insertJohn Doe, but instead you should use the corresponding member ID.Use the List Classic Search Parameters endpoint to help you find the IDs of the parameters you need.
Search with filters
To get a list of posts search results with filters, use the Perform Posts Search endpoint with a parameters body.
Note about paginationClassic posts search uses cursor-based pagination. Omit
cursoron the first request. If the response contains a
next_cursor, repeat the same request with?cursor=<next_cursor>to retrieve the next page. Stop when
next_cursoris absent. Theoffsetandlimitparameters are not supported by this endpoint.
const { data } = await linkedInApi.performClassicPostsSearch({
path: {
account_id: "acc_123456789",
},
body: {
keywords: 'Productivity',
posted_by: {
member: ['ACoA1B2C3D4E5F6g7Hi8J9K1L2m3NOpqRSTUvWxYZ']
}
},
});posts = linked_in_api.perform_classic_posts_search(
"acc_123456789",
perform_classic_posts_search_request={
"keywords": "Productivity",
"posted_by": {
"member": ["ACoA1B2C3D4E5F6g7Hi8J9K1L2m3NOpqRSTUvWxYZ"]
},
},
)curl --request POST \
--url https://api.unipile.com/v2/account_id/linkedin/search/posts \
--header 'accept: application/json'
--data '
{
"keywords": "Productivity",
"posted_by": {
member: ["ACoA1B2C3D4E5F6g7Hi8J9K1L2m3NOpqRSTUvWxYZ"]
}
}'Search from URL
For a URL to be considered valid in the context of a posts search, it must match the following pattern : https://www.linkedin.com/search/results/content.
To get a list of posts search results out of a URL, use Perform Classic Search from URL.
Searches created from a posts URL use the same cursor-based pagination. Pass the response's next_cursor as the
cursor query parameter on the following request while keeping the same URL in the request body.
const { data } = await linkedInApi.performClassicSearchFromUrl({
path: {
account_id: "acc_123456789",
},
body: {
url: "https://www.linkedin.com/search/results/content?[...]",
},
});posts = linked_in_api.perform_classic_search_from_url(
"acc_123456789",
{"url": "https://www.linkedin.com/search/results/content?[...]"},
)curl --request POST \
--url https://api.unipile.com/v2/account_id/linkedin/search \
--header 'accept: application/json'
--data '
{
"url": "https://www.linkedin.com/search/results/content?[...]"
}'Updated about 1 month ago