Create Report
Create Report
POST
/api/v1/user-reports
Description
Create a new crowdsourced user report at the given position.
Authentication
Requires a Bearer token in the Authorization header or a token query parameter.
Request Body
- reportType (Required): Report category. Supported values:
hazard,accident,weather,wildlife. - position (Required): Object with numeric
latitude(−90 to 90) andlongitude(−180 to 180). - properties (Optional): Free-form JSON. Use
descriptionfor free-text notes shown in clients. - id (Optional): Client-supplied UUID version 4. If omitted, the server generates one.
- externalUserId (Optional): Opaque user identifier from your application.
Response Schema
Returns the created User Report object.
Error Responses
- 400 Bad Request: Missing metadata, invalid coordinates, or invalid
id. - 401 Unauthorized: Token is missing or invalid.
- 409 Conflict: A report with the supplied
idalready exists.
Example Request
POST https://api.vectorcharts.com/api/v1/user-reports
Authorization: Bearer <token>
Content-Type: application/json
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"reportType": "hazard",
"position": {
"latitude": 42.36,
"longitude": -71.05
},
"properties": {
"description": "Shallow area reported"
},
"externalUserId": "app-user-abc123"
}
Example Response
Status Code: 201 Created
Response Body:
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"reportType": "hazard",
"latitude": 42.36,
"longitude": -71.05,
"properties": {
"description": "Shallow area reported"
},
"upvoteCount": 0,
"downvoteCount": 0,
"isOwner": true,
"externalUserId": "app-user-abc123",
"namespace": "public",
"createdAt": 1718380800000,
"updatedAt": 1718380800000,
"expiredAt": null,
"deletedAt": null
}