Ajouter un document au modèle
Faire signer, en plus des documents du modèle, un document propre à cet envoi.
La requête de création ne fait que remplacer les documents que le modèle porte : un identifiant convivial qu'il n'a pas y est ignoré, sans erreur. Un document de plus s'ajoute donc au brouillon, avant l'envoi.
1Créer le parcours en brouillon
curl -X POST "https://staging-api.docage.com/Transactions/CreateFullTransaction?launchTransaction=false" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9…" \
-F "TemplateId=aaaaaaaa-0000-4000-8000-000000000001" \
-F "Client=00000000-0000-4000-8000-000000000201"2Ajouter le document
curl -X POST "https://staging-api.docage.com/TransactionFiles" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9…" \
-F "TransactionId=cccccccc-0000-4000-8000-000000000003" \
-F "FileToUpload=@devis-atelier-lumiere.pdf;type=application/pdf" \
-F "Name=Devis" \
-F "FriendlyName=Devis" \
-F "Type=0"Name, le nom du document, est obligatoire ;FriendlyNamel'identifie dans le parcours — donnez-en un qu'aucun autre document ne porte.Type:0à signer (d'office),1annexe, jointe sans signature.- Le fichier : un PDF, une image ou un document Word (
.docx), converti en PDF ; à la place d'un fichier,InitialDocumentIddésigne un document ou un modèle de document de Docage.
La réponse est l'identifiant du document. Le détail : Ajouter un document.
3Poser les emplacements de signature, puis lancer
Pour chaque signataire qui doit voir son encart sur ce document, un emplacement :
POST https://staging-api.docage.com/TransactionFields
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9…
Content-Type: application/json
{ "TransactionMemberId": "dddddddd-0000-4000-8000-000000000004", "TransactionFileId": "eeeeeeee-0000-4000-8000-000000000015", "Pages": "-1", "Coordinates": "320,90,180,100" }curl -X POST "https://staging-api.docage.com/TransactionFields" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9…" \
-H "Content-Type: application/json" \
-d '{
"TransactionMemberId": "dddddddd-0000-4000-8000-000000000004",
"TransactionFileId": "eeeeeeee-0000-4000-8000-000000000015",
"Pages": "-1",
"Coordinates": "320,90,180,100"
}'using HttpClient client = new();
using HttpRequestMessage request = new(HttpMethod.Post, "https://staging-api.docage.com/TransactionFields");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Content = new StringContent("""
{
"TransactionMemberId": "dddddddd-0000-4000-8000-000000000004",
"TransactionFileId": "eeeeeeee-0000-4000-8000-000000000015",
"Pages": "-1",
"Coordinates": "320,90,180,100"
}
""", Encoding.UTF8, "application/json");
using HttpResponseMessage response = await client.SendAsync(request);
string result = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
throw new HttpRequestException(result);const response = await fetch("https://staging-api.docage.com/TransactionFields", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"TransactionMemberId": "dddddddd-0000-4000-8000-000000000004",
"TransactionFileId": "eeeeeeee-0000-4000-8000-000000000015",
"Pages": "-1",
"Coordinates": "320,90,180,100"
})
});
const text = await response.text();
if (!response.ok) throw new Error(text);
const result = text ? JSON.parse(text) : null;POST https://staging-api.docage.com/Transactions/LaunchTransaction/cccccccc-0000-4000-8000-000000000003
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9…curl -X POST "https://staging-api.docage.com/Transactions/LaunchTransaction/cccccccc-0000-4000-8000-000000000003" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9…"using HttpClient client = new();
using HttpRequestMessage request = new(HttpMethod.Post, "https://staging-api.docage.com/Transactions/LaunchTransaction/cccccccc-0000-4000-8000-000000000003");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
using HttpResponseMessage response = await client.SendAsync(request);
string result = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
throw new HttpRequestException(result);const response = await fetch("https://staging-api.docage.com/Transactions/LaunchTransaction/cccccccc-0000-4000-8000-000000000003", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`
}
});
const text = await response.text();
if (!response.ok) throw new Error(text);
const result = text ? JSON.parse(text) : null;Les pièges
- Un document à signer est signé par tous les signataires du parcours ; un emplacement ne fait que montrer l'encart. Sans emplacement, la signature est valide, mais sans encart visible sur ce document.
- Un parcours déjà lancé ne reçoit plus de document :
409, « Vous ne pouvez pas modifier un parcours actif ou terminé. »