Sample python code
import requests,json
model_id = "insert model id"
api_key = "insert api key"
inference_id = "insert inference id"
get_inferences_url = 'https://app.nanonets.com/api/v2/Inferences/Model/'+model_id+'/ImageLevelInferences/'+inference_id
response = requests.request('GET', get_inferences_url, auth=requests.auth.HTTPBasicAuth(api_key,''))
inference_data = response.json()['result'][0]
update_inference_request_body = {}
update_inference_request_body['moderated_boxes'] = inference_data['moderated_boxes']
update_inference_request_body['id'] = inference_id
update_inference_request_body['day_since_epoch'] = inference_data['day_since_epoch']
update_inference_request_body['hour_of_day'] = inference_data['hour_of_day']
for predicted_box in inference_data['predicted_boxes']:
if predicted_box['label'] == 'Required field to flag':
moderated_box = predicted_box
moderated_box['validation_status'] = 'failed'
moderated_box['validation_message'] = 'Required message'
update_inference_request_body['moderated_boxes'].append(moderated_box)
update_inferences_moderated_boxes_url = "https://app.nanonets.com/api/v2/Inferences/Model/" + model_id + "/ImageLevelInferenceModeratedBoxes"
response = requests.patch(update_inferences_moderated_boxes_url, auth=requests.auth.HTTPBasicAuth(api_key, ''), json=update_inference_request_body)
print(response.status_code)
print(response.text)