Sample-Point Reports

Upload and manage lab report files tied to one or more sample points from a sample plan.

This page covers only what's specific to sample-point reports. For the base URL, authentication, and response envelope, see SatMRV Overview.

Endpoints

MethodPathPurpose
GETstratification/sample-plan/sample-point-reports/List reports
POSTstratification/sample-plan/sample-point-reports/Create a report (multipart upload)
GETstratification/sample-plan/sample-point-reports/{id}/Retrieve a report
PUT/PATCHstratification/sample-plan/sample-point-reports/{id}/Update a report
DELETEstratification/sample-plan/sample-point-reports/{id}/Delete a report
GETstratification/sample-plan/sample-point-reports/{id}/download/Download the report file

Auth

Send your access token as a bearer token, as described in SatMRV Overview.

Required permission per action:

ActionRequired permission
List / Retrieve / Downloadsample_point_report.view
Createsample_point_report.create
Update / Partial updatesample_point_report.edit
Destroysample_point_report.delete

A request lacking the required permission gets HTTP 403 with a structured body:

{
  "code": "permission_denied",
  "message": "You do not have permission to perform this action.",
  "details": {
    "required_permission": "sample_point_report.create",
    "action": "create",
    "resource": "sample_point_report"
  }
}

Filters (list)

file_name (icontains), company, submitted_by, created_at (date range), sample_points, latitude, longitude, order, sample_plan.

Create — multipart, not JSON

Create is a multipart/form-data request, not JSON. POST files (one or more file uploads) plus sample_points as a comma-separated string of sample IDs (e.g. "12,13,14"), not a JSON array. There's a per-file size limit documented as roughly 5MB — treat that as the safe target to stay under, since the actual enforced limit in the current implementation is considerably larger due to a units mismatch in the code, not something to rely on as a hard ceiling.

A successful create returns 201 with {"message": "Sample Point Report Created Successfully"} and no data payload — you won't get the new report's ID back directly in the response. List or filter for it afterward (e.g. by sample_plan or recency) if you need its ID.

400 if any file exceeds the size limit, or if any sample_points value doesn't resolve to a sample belonging to your own company. 500 on other upload failures.

Response fields

List/retrieve responses include file_name, a nested sample_points list, and standard metadata. The internal storage-location field is deliberately excluded from every response — don't expect a raw file path or URL in the JSON; use the download action instead.

Download

GET .../{id}/download/ returns 200 with:

{
  "file_name": "lab-results.pdf",
  "content": "JVBERi0xLjQKJcOkw7zDtsO..."
}

content is always base64-encoded, regardless of any format option you might pass. 500 on storage/S3 errors.

Status codes

StatusTrigger
200List, retrieve, update, download.
201Report created.
204Report deleted.
400Validation failure — bad body, oversized file, or a sample_points value outside your company.
403Missing required permission.
404Not found.
500Upload or storage error.

Examples

Create (multipart)

curl -X POST https://backend.spacenus.de/api/v1.2/sat-mrv/stratification/sample-plan/sample-point-reports/ \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "[email protected]" \
  -F "sample_points=101,102,103"

Response:

{
  "status": "success",
  "message": "Sample Point Report Created Successfully",
  "data": null
}

Download

curl https://backend.spacenus.de/api/v1.2/sat-mrv/stratification/sample-plan/sample-point-reports/REPORT_ID/download/ \
  -H "Authorization: Bearer YOUR_TOKEN"

Response:

{
  "status": "success",
  "message": "Success",
  "data": {
    "file_name": "lab-results.pdf",
    "content": "JVBERi0xLjQKJcOkw7zDtsO..."
  }
}