92 lines
1.4 KiB
Markdown
92 lines
1.4 KiB
Markdown
# M9 API Validation Examples
|
|
|
|
All errors must use the documented API envelope.
|
|
|
|
## Invalid Project Name
|
|
|
|
Request:
|
|
|
|
```json
|
|
{ "name": "" }
|
|
```
|
|
|
|
Response:
|
|
|
|
```json
|
|
{
|
|
"success": false,
|
|
"data": null,
|
|
"error": {
|
|
"code": "validation_error",
|
|
"message": "Project name is required.",
|
|
"details": { "field": "name" }
|
|
},
|
|
"meta": {}
|
|
}
|
|
```
|
|
|
|
## Invalid GeoJSON Polygon
|
|
|
|
```json
|
|
{
|
|
"success": false,
|
|
"data": null,
|
|
"error": {
|
|
"code": "invalid_geometry",
|
|
"message": "Area geometry must be a valid Polygon or MultiPolygon in EPSG:4326.",
|
|
"details": {
|
|
"reason": "self_intersection"
|
|
}
|
|
},
|
|
"meta": {}
|
|
}
|
|
```
|
|
|
|
## Unsupported Dataset Type
|
|
|
|
```json
|
|
{
|
|
"success": false,
|
|
"data": null,
|
|
"error": {
|
|
"code": "unsupported_dataset_type",
|
|
"message": "This file type is not supported in V1.",
|
|
"details": {
|
|
"allowed_extensions": [".geojson", ".json", ".tif", ".tiff", ".gpkg"]
|
|
}
|
|
},
|
|
"meta": {}
|
|
}
|
|
```
|
|
|
|
## External Source Unavailable
|
|
|
|
```json
|
|
{
|
|
"success": false,
|
|
"data": null,
|
|
"error": {
|
|
"code": "external_service_unavailable",
|
|
"message": "The GRB service is unavailable. Use cached data or retry later.",
|
|
"details": { "source": "GRB" }
|
|
},
|
|
"meta": {}
|
|
}
|
|
```
|
|
|
|
## Job Failed
|
|
|
|
```json
|
|
{
|
|
"success": true,
|
|
"data": {
|
|
"job_id": "uuid",
|
|
"status": "failed",
|
|
"error_code": "model_not_available",
|
|
"error_message": "No compatible detection model is configured."
|
|
},
|
|
"error": null,
|
|
"meta": {}
|
|
}
|
|
```
|