REST /api/v1/field-validations 7 endpoints
GET /api/v1/field-validations/api/v1/field-validations

List validation results for a given report preview

Public

Response Example

{
  "data": [
    {
      "validation_id": "val-001",
      "preview_id": "prev-001",
      "section_id": "undersokelser",
      "field_key": "antall_undersokelser_henlagt",
      "validation_state": "error",
      "is_blocking": true,
      "message": "Feltet er påkrevd og kan ikke være tomt.",
      "current_value": null,
      "prior_value": 89,
      "validated_at": "2026-03-26T08:15:00Z"
    },
    {
      "validation_id": "val-002",
      "preview_id": "prev-001",
      "section_id": "undersokelser",
      "field_key": "andel_undersokelser_innen_frist",
      "validation_state": "warning",
      "is_blocking": false,
      "message": "Stor avvik fra forrige periode (45% mot 82%). Vennligst bekreft.",
      "current_value": 45,
      "prior_value": 82,
      "validated_at": "2026-03-26T08:15:00Z"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 2
  }
}
GET /api/v1/field-validations/api/v1/field-validations/:id

Get a single validation result by ID

Public

Response Example

{
  "validation_id": "val-001",
  "preview_id": "prev-001",
  "section_id": "undersokelser",
  "field_key": "antall_undersokelser_henlagt",
  "validation_state": "error",
  "is_blocking": true,
  "message": "Feltet er påkrevd og kan ikke være tomt.",
  "current_value": null,
  "prior_value": 89,
  "rules_applied": [
    "required",
    "non_negative_integer"
  ],
  "validated_at": "2026-03-26T08:15:00Z"
}
POST /api/v1/field-validations/api/v1/field-validations

Validate an entire report preview model and persist results

Public

Request Example

{
  "preview_id": "prev-001",
  "sections": [
    {
      "section_id": "barn-under-omsorg",
      "fields": [
        {
          "field_key": "antall_barn_plassert_utenfor_hjemmet",
          "value": 47,
          "prior_value": 52
        },
        {
          "field_key": "antall_akuttplasseringer",
          "value": 8,
          "prior_value": 6
        }
      ]
    },
    {
      "section_id": "undersokelser",
      "fields": [
        {
          "field_key": "antall_undersokelser_igangsatt",
          "value": 132,
          "prior_value": 128
        },
        {
          "field_key": "antall_undersokelser_henlagt",
          "value": null,
          "prior_value": 89
        }
      ]
    }
  ]
}

Response Example

{
  "preview_id": "prev-001",
  "validation_summary": {
    "total_fields_validated": 18,
    "valid_count": 15,
    "warning_count": 1,
    "error_count": 2,
    "has_blocking_issues": true
  },
  "issues": [
    {
      "validation_id": "val-001",
      "section_id": "undersokelser",
      "field_key": "antall_undersokelser_henlagt",
      "validation_state": "error",
      "is_blocking": true,
      "message": "Feltet er påkrevd og kan ikke være tomt."
    }
  ],
  "validated_at": "2026-03-26T08:15:00Z"
}
PUT /api/v1/field-validations/api/v1/field-validations/:id

Re-validate a single field and update its stored validation result

Public

Request Example

{
  "field_key": "antall_undersokelser_henlagt",
  "value": 91,
  "prior_value": 89
}

Response Example

{
  "validation_id": "val-001",
  "preview_id": "prev-001",
  "section_id": "undersokelser",
  "field_key": "antall_undersokelser_henlagt",
  "validation_state": "valid",
  "is_blocking": false,
  "message": null,
  "current_value": 91,
  "prior_value": 89,
  "validated_at": "2026-03-26T08:30:00Z"
}
DELETE /api/v1/field-validations/api/v1/field-validations/:id

Clear a stored validation result (e.g. when the field is reset)

Public

Response Example

{
  "deleted": true,
  "validation_id": "val-001"
}
GET /api/v1/field-validations/api/v1/field-validations/sections/:sectionId/issues

Get all validation issues for a specific section within a preview

Public

Response Example

{
  "data": [
    {
      "validation_id": "val-001",
      "field_key": "antall_undersokelser_henlagt",
      "field_label": "Antall undersøkelser henlagt",
      "validation_state": "error",
      "is_blocking": true,
      "message": "Feltet er påkrevd og kan ikke være tomt."
    },
    {
      "validation_id": "val-002",
      "field_key": "andel_undersokelser_innen_frist",
      "field_label": "Andel undersøkelser innen frist (%)",
      "validation_state": "warning",
      "is_blocking": false,
      "message": "Stor avvik fra forrige periode (45% mot 82%). Vennligst bekreft."
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 2
  }
}
GET /api/v1/field-validations/api/v1/field-validations/blocking-check

Check whether a report preview has any blocking validation issues preventing submission

Public

Response Example

{
  "preview_id": "prev-001",
  "has_blocking_issues": true,
  "blocking_issue_count": 1,
  "blocking_issues": [
    {
      "section_id": "undersokelser",
      "field_key": "antall_undersokelser_henlagt",
      "field_label": "Antall undersøkelser henlagt",
      "message": "Feltet er påkrevd og kan ikke være tomt."
    }
  ]
}

Additional Metadata

{
  "contract_summary": {
    "total_contracts": 410,
    "total_endpoints": 2416,
    "api_styles_used": [
      "rest"
    ]
  },
  "generated_at": "2026-03-26T06:55:53.316Z"
}