type Linkedin = {
token: string
apiVersion: string
}
export async function main(resource: Linkedin, postId: string) {
// The URL in script.json points to Legacy API.
const encodedPostId = encodeURIComponent(postId)
const endpoint = `https://api.linkedin.com/rest/posts/${encodedPostId}`
const response = await fetch(endpoint, {
method: 'DELETE',
headers: {
Authorization: `Bearer ${resource.token}`,
'X-Restli-Protocol-Version': '2.0.0',
'LinkedIn-Version': `${resource.apiVersion}`
}
})
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
}
const data = await response.json()
return data
}
Submitted by hugo697 128 days ago
type Linkedin = {
token: string
apiVersion: string
}
export async function main(resource: Linkedin, postId: string) {
// The URL in script.json points to Legacy API.
const encodedPostId = encodeURIComponent(postId)
const endpoint = `https://api.linkedin.com/rest/posts/${encodedPostId}`
const response = await fetch(endpoint, {
method: 'DELETE',
headers: {
Authorization: `Bearer ${resource.token}`,
'X-Restli-Protocol-Version': '2.0.0',
'LinkedIn-Version': `${resource.apiVersion}`
}
})
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
}
const data = await response.json()
return data
}
Submitted by hugo697 128 days ago