Answers - SocialGouv/code-du-travail-backoffice GitHub Wiki

List answers

GET /answers

Response

Array<{
  id: UUID
  parent_id: string | null
  value: string
  generic_reference: "labor_code" | "national_agreement" | null
  is_published: boolean
  created_at: string
  updated_at: string
  question_id: UUID
  agreement_id: UUID| null
}>

The parent_id column is not used at the moment (always set to null) and is planned to allow answers splitting in order to create "sub-answers" covering special cases: permanent or temporary contracts, full or part-time, etc.

Value

The answers' value is formatted in Markdown.

Generic Answers

Answers with an agreement_id value set to null represent the generic answers from Labor Code.

Examples

Get all the generic answers

With the question value embedded and sorted by last update:

curl https://contributions-api.codedutravail.fabrique.social.gouv.fr/answers?select=*,question(value)&agreement_id=is.null&order=updated_at.desc

Get one answer for a specific agreement and question

We also link the agreement, the question and the references:

curl https://contributions-api.codedutravail.fabrique.social.gouv.fr/answers?select=*,agreement(*),question(*),references:answers_references(*)&agreement_id=eq.074540ca-05e7-4944-81c1-9ac17c0ca64b&question_id=eq.1f93464e-2691-454f-a2c9-d925e907601c