Retry File Upload via API
Overview:
This API allows you to retry predictions for specific files on an existing model. You provide a list of file IDs, and the API retries the object detection on those files.
Endpoint:
URL: https://app.nanonets.com/api/v2/ObjectDetection/Model/{model_id}/RetryPrediction
Method: POST
Authentication:
API Key: Required in the auth parameter.
Method: Basic Authentication, with the API key as the username and an empty string as the password.
Request Parameters:
-
Path Parameter:
- model_id (string): The unique identifier of the model for which you want to retry predictions.
-
Headers:
Content-Type: application/json
-
Body Parameters (JSON):
- file_ids (list of strings): A list of file IDs for which the prediction should be retried.
{ "file_ids": ["<file_id1>", "<file_id2>", "..."] }
Sample Request:
python:
import requests
import json
# API URL with model ID
url = "https://app.nanonets.com/api/v2/ObjectDetection/Model/{model_id}/RetryPrediction"
# Model ID
model_id = "Model Id"
# API Key for authentication
api_key = 'API KEY'
# Define the payload with the file IDs to retry prediction on
payload = {"file_ids": ["file_id1", "file_id2", "file_id3",..]}
# Convert the payload to JSON format
payload_json = json.dumps(payload)
# Make the POST request
response = requests.post(
url.format(model_id=model_id), # Insert model_id into the URL
auth=(api_key, ''), # Use API key for authentication
headers={"Content-Type": "application/json"}, # Set the content type to JSON
data=payload_json # Pass the JSON payload
)
# Print the response from the API
print(response.text)
curl:
curl -X POST "https://app.nanonets.com/api/v2/ObjectDetection/Model/{mode_id}/RetryPrediction" \
-u "API_KEY:" \
-H "Content-Type: application/json" \
-d '{"file_ids": ["file_id1", "file_id2", "file_id3",..]}'
- -X POST: Specifies the HTTP method as POST.
- -u "API_KEY:": Provides the API key for basic authentication. The API key is passed as the username, and the password is left blank.
- -H "Content-Type: application/json": Sets the Content-Type header to application/json.
- -d '{"file_ids": [["file_id1", "file_id2", "file_id3",..]}': Sends the JSON payload with the list of file IDs.
Updated 4 months ago