Edits history of script submission #9073 for ' Get Monthly User Usage (jotform)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Jotform = {
    	apiKey: string
    	baseUrl: string
    }
    
    export async function main(resource: Jotform) {
    	const queryParams = new URLSearchParams({ apiKey: resource.apiKey })
    
    	const endpoint = `${resource.baseUrl}/user/usage?${queryParams.toString()}`
    
    	const response = await fetch(endpoint, {
    		method: 'GET',
    		headers: {
    			'Content-Type': 'application/json'
    		}
    	})
    
    	if (!response.ok) {
    		throw new Error(`HTTP error! status: ${response.status}`)
    	}
    
    	const data = await response.json()
    
    	return data
    }
    

    Submitted by hugo697 621 days ago