Aller au contenu

Types de pièces jointes

Ces routes gèrent le référentiel global des types de pièces jointes. Toutes sont authentifiées. Les lectures sont accessibles sans privilège fonctionnel supplémentaire, les mutations exigent admin_attachments.

Authentification, privilège et périmètre

Toutes les actions exigent une authentification et portent sur le référentiel global de l’instance. GET /rest/attachmentsTypes et GET /rest/attachmentsTypes/{id} n’ajoutent aucun contrôle de privilège, les créations, modifications et suppressions exigent admin_attachments.

Structure d’un type

Valeur Type Description
id integer Identifiant technique
typeId string Identifiant fonctionnel
label string Libellé
visible boolean Visibilité dans l’interface
emailLink boolean Disponibilité comme lien dans un courriel
signable boolean Type signable
signedByDefault boolean Signature sélectionnée par défaut
icon string ou null Identifiant d’icône
chrono boolean Génération d’un chrono
versionEnabled boolean Gestion des versions
newVersionDefault boolean Création d’une version par défaut
inSignatureBook boolean Ajout au parapheur par défaut

Lister les types

Route

GET /rest/attachmentsTypes

Le type interne summary_sheet est exclu de la réponse.

Retour

Code HTTP Type Description Exemple
200 object Objet indexé par typeId {"attachmentsTypes":{"response_project":{"id":1,"typeId":"response_project","label":"Projet de réponse","visible":true}}}

Lire un type

Route

GET /rest/attachmentsTypes/{id}

Paramètres d’URL

Valeur Type Obligatoire Description
id integer Oui Identifiant technique

Retour

Code HTTP Type Description Exemple
200 object Type trouvé {"id":12,"typeId":"annexe_exemple","label":"Annexe","visible":true}
400 object Type absent {"errors":"Attachment type does not exist"}

Créer un type

Route

POST /rest/attachmentsTypes

Body

Valeur Type Obligatoire Description
typeId string Oui Identifiant non numérique et unique
label string Oui Libellé non numérique
visible boolean Non false par défaut
emailLink boolean Non false par défaut
signable boolean Non false par défaut
signedByDefault boolean Non false par défaut
chrono boolean Non false par défaut
icon string ou null Non Identifiant d’icône
versionEnabled boolean Non false par défaut
newVersionDefault boolean Non false par défaut
inSignatureBook boolean Non false par défaut
{
  "typeId": "annexe_exemple",
  "label": "Annexe",
  "visible": true,
  "signable": false
}

Retour

Code HTTP Type Description Exemple
200 object Type créé {"id":12}
400 object Body vide {"errors":"Body is not set or empty"}
400 object Identifiant ou libellé invalide Message exact du champ concerné
400 object Identifiant déjà utilisé {"errors":"Body typeId is already used by another type","lang":"attachmentTypeIdAlreadyUsed"}
403 object Privilège absent {"errors":"Service forbidden"}

Modifier un type

Route

PUT /rest/attachmentsTypes/{id}

Paramètres d’URL

Valeur Type Obligatoire Description
id integer Oui Identifiant technique

Body

label est obligatoire. Les autres propriétés du tableau de création sont facultatives. Si typeId est fourni, il doit être identique à celui déjà enregistré.

{
  "typeId": "annexe_exemple",
  "label": "Annexe mise à jour",
  "visible": true,
  "versionEnabled": true
}

Retour

Code HTTP Type Description Exemple
204 vide Type modifié Aucune réponse
400 object Type absent ou identifiant modifié {"errors":"Attachment type not found or altered"}
400 object Type interne rendu visible {"errors":"This attachment type cannot be made visible"}
400 object Option obligatoire désactivée {"errors":"This option cannot be disabled on this type"}
403 object Privilège absent {"errors":"Service forbidden"}

Supprimer un type

Route

DELETE /rest/attachmentsTypes/{id}

Paramètres d’URL

Valeur Type Obligatoire Description
id integer Oui Identifiant technique

Retour

Code HTTP Type Description Exemple
204 vide Type supprimé Aucune réponse
400 object Type absent {"errors":"Attachment type does not exist"}
400 object Type interne protégé {"errors":"This attachment type cannot be deleted"}
400 object Type utilisé par une pièce jointe non supprimée {"errors":"Type is used in attachments","lang":"attachmentTypeUsed"}
403 object Privilège absent {"errors":"Service forbidden"}