Saltar al contenido

Retire a course

Módulo Workforce

POST/training-courses/{id}/retiretrainingCourses.retire

Retires a published course. Requires `Idempotency-Key`; a replay returns the original response. A rule that refuses the request returns 422 with `refusal` and `reason`.

  • Requiere la capacidad knowledge.sop.publish.
  • Alcances de OAuth: knowledge.
  • Envía el encabezado Idempotency-Key. Una repetición con la misma clave devuelve la respuesta original.
  • Estados de error: 400, 401, 404, 409, 422, 429. Los errores son detalles de problema RFC 9457.

Parámetros de ruta y de consulta

trainingCourses.retire: Parámetros de ruta y de consulta
CampoTipoObligatorioDescripción
idstring (uuid)SíIdentifier of the training course.

Cuerpo de la solicitud: RetireCourseRequest

trainingCourses.retire: RetireCourseRequest
CampoTipoObligatorioDescripción
reasonstringSíWhy it is retired.Restricciones: length 1 to 500
{
  "reason": "Posted to the wrong project."
}

Respuesta 200: TrainingCourse

trainingCourses.retire: TrainingCourse
CampoTipoObligatorioDescripción
idstring (uuid)SíIdentifier of the training course.
org_idstring (uuid)SíIdentifier of the owning organization, derived from the parent row and never accepted from the caller.
created_atstring (date-time)SíWhen the row was created.
created_bystring (uuid) | nullSíPerson who created the row; null for seed, platform or system writes.
updated_atstring (date-time)SíWhen the row was last updated.
updated_bystring (uuid) | nullSíPerson who last updated the row; null for seed, platform or system writes.
titlestringSíCourse title.Restricciones: length 1 to 200
summarystring | nullSíWhat the course teaches.Restricciones: length 1 to 2000
role_codestring | nullSíCanon role trained for.Restricciones: pattern ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$
certification_idstring (uuid) | nullSíIdentifier of the org certification a pass qualifies for.
gate_criterion_idstring | nullSíCanon gate criterion the course helps satisfy.Restricciones: pattern ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$
validity_daysinteger | nullSíDays a pass stays current.Restricciones: range 1 to any
pass_percentintegerSíQuiz score needed to pass, in percent.Restricciones: range 1 to any
estimated_minutesinteger | nullSíExpected time.Restricciones: range 1 to any
course_state"Draft" | "Published" | "Retired"SíCourse state.
{
  "id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
  "org_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
  "created_at": "2026-10-08T14:30:00Z",
  "created_by": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
  "updated_at": "2026-10-08T14:30:00Z",
  "updated_by": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
  "title": "Rigging basics",
  "summary": "Slings and shackles.",
  "role_code": "5000.01.01",
  "certification_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
  "gate_criterion_id": "G3.CREW_TRAINED",
  "validity_days": 365,
  "pass_percent": 80,
  "estimated_minutes": 20,
  "course_state": "Draft"
}

Ejemplos de código

curl -X POST "$XOS_BASE_URL/training-courses/0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f/retire" \
  -H "Authorization: Bearer $XOS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"reason":"Posted to the wrong project."}'
const { data } = await xos.trainingCourses.retire("0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f", {
    "reason": "Posted to the wrong project."
  });
response = xos.training_courses.retire("0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f", {"reason": "Posted to the wrong project."})
xos training-courses retire 0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f --data '{"reason":"Posted to the wrong project."}'