Passa al contenuto principale

Ottieni conoscenza base

L'API per l'ottenimento dei modelli di app.neoagent.co fornisce la funzionalità per creare un nuovo chatbot inviando una richiesta POST all'endpoint /chat/Chatbot/GetSource.

Endpoint

URL della Richiesta: https://app.neoagent.co/chat/Chatbot/GetSource
Metodo: POST

Corpo della Richiesta

Il corpo della richiesta deve contenere i seguenti parametri:

{
// string, required - The unique identifier (ID) of the chatbot
"serialNumber": "3254a9d0424c4806b9ea3d0763xxxxxx"
}

Parametri

  • serialNumber - string, obbligatorio - L'identificativo unico (ID) del chatbot da eliminare

Headers richiesti

La richiesta API deve includere i seguenti header:

  • Authorization: <Your-Secret-Key> - string, obbligatorio - La chiave segreta per autenticare la richiesta API
  • Content-Type: application/json - string, obbligatorio - Il tipo di contenuto del payload della richiesta (deve essere application/json)

Esempi di Richiesta

const res = await fetch('https://app.neoagent.co/chat/Chatbot/GetSource', {
method: 'POST',
headers: {
"Authorization": "<Your-Secret-Key>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"serialNumber": "3254a9d0424c4806b9ea3d0763xxxxxx"
})
});

const data = await res.json();
console.log(data);

Risposta

La risposta API sarà un oggetto JSON con la seguente struttura:

{
// array - List of knowledge items
"Data": [
{
"Type": "FileList",
"Name": "34321",
"Value": "FAQ_0403.txt",
"Length": 12043,
"Status": 2,
"StatusMessage": "Succeeded",
"ID": 377631,
"SourceLink": ""
},
{
"Type": "CompanyInfo",
"Name": "CompanyInfo",
"Value": "",
"Length": 286,
"Status": 2,
"StatusMessage": "Succeeded",
"ID": 377634,
"SourceLink": ""
},
{
"Type": "UrlList",
"Name": "www.example.com",
"Value": "",
"Length": 0,
"Status": 3,
"StatusMessage": "Failed",
"ID": 377635,
"SourceLink": "www.example.com"
},
{
"Type": "Text",
"Name": "111111111",
"Value": "",
"Length": 9,
"Status": 2,
"StatusMessage": "Succeeded",
"ID": 377636,
"SourceLink": ""
},
{
"Type": "QAList",
"Name": "Question",
"Value": "Answer",
"Length": 9,
"Status": 2,
"StatusMessage": "Succeeded",
"ID": 377627,
"SourceLink": ""
}
],
// string - API version
"Version": "1.0.0",
// boolean - Operation success status
"Success": true,
// integer - HTTP status code
"Code": 200,
// string - Error message if any
"Message": ""
}

Gestione degli Errori

Se la richiesta fallisce, dovresti:

  1. Controllare il codice di stato HTTP per errori a livello di rete
  2. Esaminare i campi Code e Message nella risposta per errori a livello business
  3. Il campo Message conterrà informazioni dettagliate sull'errore