<POST> Model Registration
POST /api/ais/v1.5/model_registration/upload
- x-api-keyStringrequiredDescription
- Org-IdStringrequiredDescription
- task_typestringrequiredDescription
- analysis_typestringrequiredDescription
import requests
import json
url = "https://api.aws.boschaishield.com/prod/api/ais/v1.5/model_registration/upload"
# please select proper payload for your usecase from request body.
payload = {
'task_type':"<<task_type>>",
"analysis_type": "<<analysis_type>>"
}
headers = {
'Accept': 'application/json',
'x-api-key': '########################################',
'Org-Id': '####################################################################################################'
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.text)curl --location 'https://api.aws.boschaishield.com/prod/api/ais/v1.5/model_registration/upload' \
--header 'x-api-key: ########################################' \
--header 'Org-Id: ####################################################################################################' \
--header 'Content-Type: application/json' \
--data '{
"task_type": "<<task_type>>",
"analysis_type": "<<analysis_type>>"
}'var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.aws.boschaishield.com/prod/api/ais/v1.5/model_registration/upload',
'headers': {
'x-api-key': '########################################',
'Org-Id': '####################################################################################################',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'task_type': '<< Enter Task Type >>',
'analysis_type': '<< Enter Analysis Type>>'
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
var myHeaders = new Headers();
myHeaders.append("Org-id", "####################################################################################################");
myHeaders.append("x-api-key", "########################################");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"task_type": "<<Enter Task Type>>",
"analysis_type": "<<Enter Analysis Type>>"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.aws.boschaishield.com/prod/api/ais/v1.5/model_registration/upload", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));// Returns a JSON object containing a unique model ID and URLs to upload required files.// Returns an error message if the provided API key or Org-ID is invalid or expired.// Returns an error message if the application cannot or will not process the request due to something that is perceived to be a client error (for example, malformed request syntax, invalid request message framing, etc.).// Returns an error message if access to the target resource has been denied (for example, if any of the parameter value is incorrect or license has expired).Request Body
{
"task_type":"nlp_classification",
"analysis_type": "extraction"
}The request body is a JSON object with the following fields:
- task_type: The name of the task type. Possible values are IC (Image Classification, IS (Image Segmentation), TC (Tabular Classification), TSF (Time Series Forecasting), Text (NLP classification).
- analysis_type: The name of the analysis type. Possible values are MEA (Model Extraction Attack), EVA (Model Evasion Attack), and data-poisoning or poisoning for (data poisoning) and model-poisoning for (model poisoning).
Model Upload Option
POST /ais/v1.5/model_registration/upload
After receiving the unique model ID and URLs from the vulnerability analysis API, users can upload the required data and track the progress further.
Note: All files uploaded to the specified URL should be in zipped format. This only needs to be done once for any model and multiple analyses can be performed. Check Image Classification, Image Segmentation Tabular Classification, Time Series Forecasting & Text Recommendation (Alpha-release), Object Detection to know the file upload format.
Note: The model, data, and label must be uploaded to the given link within ten minutes. For Image Classification Poisoning addition, two clean models are required. The model_id must be saved by the user for future use.
For using Nodejs sample code, install npm package request
Given ample code for python is tested for Python version 3.7
Given Sample code for nodejs and javascript is tested for Node V20LTS