Edits history of script submission #9001 for ' Get Reports (campayn)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Campayn = {
    	apiKey: string
    }
    
    export async function main(resource: Campayn) {
    	const endpoint = `https://campayn.com/api/v1/reports/calendar.json`
    
    	const response = await fetch(endpoint, {
    		method: 'GET',
    		headers: {
    			Authorization: `TRUEREST apikey=${resource.apiKey}`
    		}
    	})
    
    	if (!response.ok) {
    		throw new Error(`HTTP error! status: ${response.status}`)
    	}
    
    	const data = await response.json()
    
    	return data
    }
    

    Submitted by hugo697 652 days ago