POST /absence

Crée une nouvelle demande d'absence pour un collaborateur.

Workflow de validation

Par défaut, l'absence est créée en état "waiting" (en attente de validation). Le responsable peut ensuite la valider ("accepted") ou la refuser ("rejected").

Gestion des demi-journées

Les absences supportent les demi-journées :

  • Utilisez from_moment et to_moment avec les valeurs "full", "half-am" ou "half-pm"
  • Exemple : absence du lundi après-midi au mercredi matin

Résolution automatique du collaborateur

Si vous fournissez uniquement positionTo sans userTo, l'API récupère automatiquement l'utilisateur associé au poste.

Événement déclenché

Un événement CREATE_ABSENCE est émis après la création, permettant de notifier les responsables de la nouvelle demande.

application/json

Body Required

  • from string(date-time) Required

    Date de début de l'absence (obligatoire)

  • from_moment string

    Moment de début :

    • full : Journée entière (défaut)
    • half-am : Matin uniquement
    • half-pm : Après-midi uniquement

    Values are half-am, half-pm, or full. Default value is full.

  • to string(date-time) Required

    Date de fin de l'absence (obligatoire)

  • to_moment string

    Moment de fin :

    • full : Journée entière (défaut)
    • half-am : Matin uniquement
    • half-pm : Après-midi uniquement

    Values are half-am, half-pm, or full. Default value is full.

  • type string Required

    Référence vers le type d'absence (obligatoire)

  • userTo string

    Utilisateur concerné par l'absence. Optionnel si positionTo est fourni (résolu automatiquement).

  • positionTo string

    Poste concerné par l'absence. Si fourni sans userTo, l'utilisateur est résolu automatiquement.

  • state string

    État initial de l'absence (waiting par défaut)

    Values are waiting, accepted, rejected, or canceled. Default value is waiting.

  • logs array[object]

    Historique initial (généralement vide à la création)

    Hide logs attributes Show logs attributes object
    • comment string

      Commentaire (motif de l'absence, etc.)

    • file string

      Pièce jointe (justificatif, certificat médical, etc.)

Responses

  • 201 application/json

    Absence créée avec succès

    Hide response attribute Show response attribute object
    • newAbsence object
      Hide newAbsence attributes Show newAbsence attributes object
      • _id string

        Unique identifier for the absence

      • company string

        Reference to the company

      • decision_date string(date-time)

        Date when the state was changed

      • from string(date-time)

        Start date of the absence

      • from_moment string

        Moment of the day when the absence starts

        Values are half-am, half-pm, or full.

      • logs array[object]

        List of logs for the absence

        Hide logs attributes Show logs attributes object
        • position string

          Reference to the position

        • date string(date-time)

          Date of the log

        • method string

          HTTP method used

        • state string

          State of the absence at the time of the log

        • stateItemRequested string

          State of the item requested

        • comment string

          Comment added to the log

        • file string

          File attached to the log

        • fileInSafe boolean

          Whether the file is stored in the safe

          Default value is false.

        • stateLog string

          State of the log

          Values are active or inactive. Default value is active.

      • period string

        Period type of the absence

        Values are period, full, or half.

      • positionDecider string

        Reference to the position that made the decision

      • positionFrom string

        Reference to the position that created the absence

      • positionTo string

        Reference to the position for which the absence is created

      • positionLastName string

        Last name of the position for search purposes

      • positionFirstName string

        First name of the position for search purposes

      • state string

        State of the absence

        Values are waiting, accepted, rejected, canceled, or inactive. Default value is waiting.

      • nbDays number

        Number of days of absence

        Default value is 0.

      • to string(date-time)

        End date of the absence

      • to_moment string

        Moment of the day when the absence ends

        Values are half-am, half-pm, or full.

      • timezone string

        Timezone for the absence dates

      • type string

        Reference to the absence type

      • userTo string

        Reference to the user for which the absence is created

      • createdAt string(date-time)

        Date when the absence was created

      • updatedAt string(date-time)

        Date when the absence was last updated

  • 400

    Requête invalide - Dates manquantes ou incorrectes

  • 403

    Non autorisé - Droits insuffisants pour créer une absence

POST /absence
curl \
 --request POST 'https://wuro.pro/api/v3.2/absence' \
 --header "X-APP-ID: $API_KEY" \
 --header "X-APP-SECRET: $API_KEY" \
 --header "Content-Type: application/json" \
 --data '{"from":"2024-12-23T00:00:00.000Z","from_moment":"full","to":"2024-12-27T00:00:00.000Z","to_moment":"full","type":"string","userTo":"string","positionTo":"string","state":"waiting","logs":[{"comment":"string","file":"string"}]}'
Request examples
{
  "from": "2024-12-23T00:00:00.000Z",
  "from_moment": "full",
  "to": "2024-12-27T00:00:00.000Z",
  "to_moment": "full",
  "type": "string",
  "userTo": "string",
  "positionTo": "string",
  "state": "waiting",
  "logs": [
    {
      "comment": "string",
      "file": "string"
    }
  ]
}
Response examples (201)
{
  "newAbsence": {
    "_id": "string",
    "company": "string",
    "decision_date": "2025-05-04T09:42:00Z",
    "from": "2025-05-04T09:42:00Z",
    "from_moment": "half-am",
    "logs": [
      {
        "position": "string",
        "date": "2025-05-04T09:42:00Z",
        "method": "string",
        "state": "string",
        "stateItemRequested": "string",
        "comment": "string",
        "file": "string",
        "fileInSafe": false,
        "stateLog": "active"
      }
    ],
    "period": "period",
    "positionDecider": "string",
    "positionFrom": "string",
    "positionTo": "string",
    "positionLastName": "string",
    "positionFirstName": "string",
    "state": "waiting",
    "nbDays": 0,
    "to": "2025-05-04T09:42:00Z",
    "to_moment": "half-am",
    "timezone": "string",
    "type": "string",
    "userTo": "string",
    "createdAt": "2025-05-04T09:42:00Z",
    "updatedAt": "2025-05-04T09:42:00Z"
  }
}