Edits history of script submission #8876 for ' Get Member Profile (linkedin)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    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 689 days ago

  • nativets
    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 689 days ago