Remplacer un participant par un contact existant
Désigner, pour un participant du modèle, un contact ou un utilisateur déjà enregistré, par son identifiant.
Le modèle porte un participant « Client » à définir : à chaque envoi, vous désignez la personne. Si elle est déjà un contact de Docage, son identifiant suffit.
1Trouver le contact
Cherchez-le par son email, par exemple :
QUERY https://staging-api.docage.com/Contacts
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9…
Content-Type: application/json
{ "Filter": { "PropertyName": "Email", "Comparison": "=", "Value": "camille.martin@example.com" }, "Take": 2, "EntityProperties": ["Id", "Name"] }curl -X QUERY "https://staging-api.docage.com/Contacts" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9…" \
-H "Content-Type: application/json" \
-d '{
"Filter": {"PropertyName": "Email", "Comparison": "=", "Value": "camille.martin@example.com"},
"Take": 2,
"EntityProperties": ["Id", "Name"]
}'using HttpClient client = new();
using HttpRequestMessage request = new(new HttpMethod("QUERY"), "https://staging-api.docage.com/Contacts");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Content = new StringContent("""
{
"Filter": {
"PropertyName": "Email",
"Comparison": "=",
"Value": "camille.martin@example.com"
},
"Take": 2,
"EntityProperties": [
"Id",
"Name"
]
}
""", 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/Contacts", {
method: "QUERY",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"Filter": {"PropertyName": "Email", "Comparison": "=", "Value": "camille.martin@example.com"},
"Take": 2,
"EntityProperties": ["Id", "Name"]
})
});
const text = await response.text();
if (!response.ok) throw new Error(text);
const result = text ? JSON.parse(text) : null;2Créer le parcours
curl -X POST "https://staging-api.docage.com/Transactions/CreateFullTransaction" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9…" \
-F "TemplateId=aaaaaaaa-0000-4000-8000-000000000001" \
-F "Client=00000000-0000-4000-8000-000000000201"La clé est l'identifiant convivial du participant (Client), la valeur l'identifiant d'un contact ou d'un utilisateur de
Docage : un contact d'abord, sinon un utilisateur. Le participant prend ses coordonnées — prénom, nom, email, mobile — sur sa fiche.
Un observateur du modèle se désigne de la même façon, sous son propre identifiant convivial (-F "Comptable=…").
Les refus
- « Aucun contact ou utilisateur trouvé pour le participant Client » : l'identifiant ne désigne aucune fiche.
- « Vous n'avez pas le droit de voir le contact ou l'utilisateur lié à … » : la fiche existe, mais vous ne la voyez pas.
Dans les deux cas la réponse est 400, et rien n'est créé.
Les pièges
- Le contact doit avoir un email, un prénom et un nom, et un mobile si le code de signature part par SMS : sinon l'envoi est refusé.
- Rien ne change sur la fiche du contact : pour la mettre à jour en même temps, voir Remplacer un participant par un nouveau contact.