Edits history of script submission #9089 for ' Validate Email (abstractapi)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Abstractapi = {
    	apiKey: string
    }
    
    export async function main(resource: Abstractapi, email: string) {
    	const queryParams = new URLSearchParams({
    		api_key: resource.apiKey,
    		email,
    		auto_correct: 'false'
    	})
    
    	const endpoint = `https://emailvalidation.abstractapi.com/v1?${queryParams.toString()}`
    
    	const response = await fetch(endpoint, {
    		method: 'GET'
    	})
    
    	if (!response.ok) {
    		throw new Error(`HTTP error! status: ${response.status}`)
    	}
    
    	const data = await response.json()
    
    	return data
    }
    

    Submitted by hugo697 591 days ago