Documentation AIME API JavaScript Client Interface
- class ModelAPI(endpointName, user, key, defaultProgressIntervall=300)
Class for communication with the AIME Model API.
Constructor of the class.
- Arguments:
endpointName (string) – The name of the API endpoint.
user (string) – api user
key (sting) – api Key required to authenticate and authorize to use api endpoint *
defaultProgressIntervall (number) – The intervall for progress updates in milliseconds. The default progress update intervall is 300.
- ModelAPI.doAPILogin(resultCallback=null, user="null", key=null)
Method for API login.
- Arguments:
resultCallback (function) – The callback after successful login.
user (string) – optinal: set to new api user
key (sting) – optional: set to new api Key required to authenticate and authorize to use api endpoint
- ModelAPI.doAPIRequest(params, resultCallback, progressCallback=null, progressStream=false)
Method for API requests with options for progress updates.
- Arguments:
params (Object) – The parameters of the API request.
resultCallback (function) – The callback after the request is completed.
progressCallback (function) – The callback for progress updates.
progressStream (boolean) – Specifies whether the progress should be streamed (default: false). Attention: The stream feature is not yet fully implemented.
- ModelAPI.fetchAsync(url, params, doPost=true)
Method for asynchronous HTTP requests (GET and POST).
- Arguments:
url (string) – The URL of the request.
params (Object) – The parameters of the request.
doPost (boolean) – Specifies whether the request is a POST request (default: true).
- Returns:
Object – - The JSON data of the response.
- ModelAPI.fetchAuthKey(endpointName)
Method for retrieving the authentication key.
- Arguments:
endpointName (string) – The name of the API endpoint.
- Returns:
string – - The authentication key if successful
- ModelAPI.pollProgress(url, jobID, resultCallback, progressCallback)
Method for polling progress updates.
- Arguments:
url (string) – The URL for progress updates.
jobID (string) – The ID of the job for progress updates.
resultCallback (function) – The callback after the request is completed.
progressCallback (function) – The callback for progress updates.
- ModelAPI.setupProgressStream(jobID, progressCallback)
Method to set up a progress stream.
- Arguments:
jobID (string) – The ID of the job for the progress stream.
progressCallback (function) – The callback for progress updates.