To create a new class via the API you can:
{@html hljs.highlight( `let form = new FormData(); form.append('json_data', JSON.stringify({ id: '${model.id}', name: 'New class name' })); form.append('file', file, 'file'); const headers = new Headers(); headers.append('response-type', 'application/json'); headers.append('token', token); const r = await fetch('${window.location.protocol}//${window.location.hostname}/models/data/class/new', { method: 'POST', headers: headers, body: form });`, { language: 'javascript' } ).value}