type Linkedin = {
token: string
apiVersion: string
}
export async function main(resource: Linkedin, personId: string) {
// This API will only return data for members who have not limited their off-LinkedIn visibility.
const endpoint = `https://api.linkedin.com/rest/people/(id:${personId})`
const response = await fetch(endpoint, {
method: 'GET',
headers: {
Authorization: `Bearer ${resource.token}`,
'LinkedIn-Version': `${resource.apiVersion}`,
'X-Restli-Protocol-Version': '2.0.0'
}
})
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
}
const data = await response.json()
return data
}
Submitted by hugo697 129 days ago
type Linkedin = {
token: string
apiVersion: string
}
export async function main(resource: Linkedin, personId: string) {
// This API will only return data for members who have not limited their off-LinkedIn visibility.
const endpoint = `https://api.linkedin.com/rest/people/(id:${personId})`
const response = await fetch(endpoint, {
method: 'GET',
headers: {
Authorization: `Bearer ${resource.token}`,
'LinkedIn-Version': `${resource.apiVersion}`,
'X-Restli-Protocol-Version': '2.0.0'
}
})
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
}
const data = await response.json()
return data
}
Submitted by hugo697 130 days ago