Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aveek22/651ce87c660ebee304b78dbd85713343 to your computer and use it in GitHub Desktop.
Save aveek22/651ce87c660ebee304b78dbd85713343 to your computer and use it in GitHub Desktop.
url = "https://api.linkedin.com/v2/shares"
headers = {
'Authorization' : f'Bearer {access_token}',
'Content-Type' : 'application/json'
}
payload = {
"content": {
"contentEntities": [
{
"entityLocation": "https://www.redhat.com/en/topics/api/what-is-a-rest-api",
"thumbnails": [
{
"resolvedUrl": "https://images.pexels.com/photos/2115217/pexels-photo-2115217.jpeg"
}
]
}
],
"title": "What is a REST API?"
},
'distribution': {
'linkedInDistributionTarget': {}
},
'owner': f'urn:li:organization:{organization_id}',
'text': {
'text': f'Learn more about REST APIs in details. \n#restapi #api'
}
}
response = requests.post(url=url, headers=headers, json = payload)
print(response.json())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment