Edits history of script submission #9042 for ' Get Organisations (certopus)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Certopus = {
    	apiKey: string
    }
    
    export async function main(resource: Certopus) {
    	const endpoint = `https://api.certopus.com/v1/organisations`
    
    	const response = await fetch(endpoint, {
    		method: 'GET',
    		headers: {
    			accept: 'application/json',
    			'x-api-key': resource.apiKey
    		}
    	})
    
    	if (!response.ok) {
    		throw new Error(`HTTP error! status: ${response.status}`)
    	}
    
    	const data = await response.json()
    
    	return data
    }
    

    Submitted by hugo697 604 days ago