cURL
curl --request POST \ --url https://app.zappway.ai/api/datasources \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: multipart/form-data' \ --form 'fileName=<string>' \ --form type=file \ --form 'datastoreId=<string>' \ --form 'custom_id=<string>'
{ "id": "<string>", "type": "<string>", "name": "<string>", "status": "unsynched", "groupId": "<string>", "updatedAt": "2023-12-25", "createdAt": "2023-12-25", "lastSynch": "2023-12-25", "config": {} }
const apiUrl = 'https://app.zappway.ai/api'; const apiKey = 'XXX'; const datastoreId = 'XXX'; const fileName = 'test.pdf'; const buffer = fs.readFileSync(fileName); const formData = new FormData(); formData.append( 'file', new Blob([buffer], { type: 'application/pdf', }), fileName ); formData.append('type', 'file'); formData.append('datastoreId', datastoreId); formData.append('fileName', fileName); const res = await fetch(`${apiUrl}/datasources`, { method: 'POST', body: formData, headers: { Authorization: `Bearer ${apiKey}`, }, });
const apiUrl = 'https:/app.zappway.ai/api'; const apiKey = 'XXX'; const datastoreId = 'XXX'; const res = await fetch(`${apiUrl}/datasources`, { method: 'POST', body: JSON.stringify({ datastoreId, type: 'web_page', name: 'Nuclear Fusion - Wikipedia', config: { source_url: 'https://en.wikipedia.org/wiki/Nuclear_fusion', }, }), headers: { ContentType: 'application/json', Authorization: `Bearer ${apiKey}`, }, });
const apiUrl = 'https://app.zappway.ai'; const apiKey = 'XXX'; const datastoreId = 'XXX'; const res = await fetch(`${apiUrl}/datasources`, { method: 'POST', body: JSON.stringify({ datastoreId, type: 'web_site', name: 'ZappWay Docs', config: { // Sitemap sitemap: 'https://docs.zappway.ai/sitemap.xml', // Or Auto Discovery source_url: 'https://docs.zappway.ai', }, }), headers: { ContentType: 'application/json', Authorization: `Bearer ${apiKey}`, }, });
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Bearer <token>
<token>
Success
The response is of type object.
object