type Linkedin = {
token: string
apiVersion: string
}
export async function main(resource: Linkedin, personIdList: string[]) {
const personIdUrl = personIdList.map((id) => `(id:${id})`).join(',')
// https://api.linkedin.com/rest/people?ids=List((id:{Person ID1}),(id:{Person ID2}),(id:{Person ID3}))
const endpoint = `https://api.linkedin.com/rest/people?ids=List(${personIdUrl})`
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 158 days ago
type Linkedin = {
token: string
apiVersion: string
}
export async function main(resource: Linkedin, personIdList: string[]) {
const personIdUrl = personIdList.map((id) => `(id:${id})`).join(',')
// https://api.linkedin.com/rest/people?ids=List((id:{Person ID1}),(id:{Person ID2}),(id:{Person ID3}))
const endpoint = `https://api.linkedin.com/rest/people?ids=List(${personIdUrl})`
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 158 days ago