Organisations et intégrateurs
À quelle organisation appartient une fiche, et comment un intégrateur agit pour ses organisations clientes.
Chaque fiche appartient à une organisation : son identifiant est dans ParentOrganizationId. Chaque utilisateur appartient
à une organisation, et l'API agit dans la sienne par défaut.
Créer dans une autre organisation
Une fiche créée sans ParentOrganizationId appartient à l'organisation de l'utilisateur. Pour créer dans une autre organisation,
désignez-la :
POST https://staging-api.docage.com/Contacts
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9…
Content-Type: application/json
{
"ParentOrganizationId": "5c6d7e8f-0000-4000-8000-000000000042",
"FirstName": "Hugo",
"LastName": "Lefèvre",
"Email": "hugo.lefevre@example.com"
}curl -X POST "https://staging-api.docage.com/Contacts" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9…" \
-H "Content-Type: application/json" \
-d '{
"ParentOrganizationId": "5c6d7e8f-0000-4000-8000-000000000042",
"FirstName": "Hugo",
"LastName": "Lefèvre",
"Email": "hugo.lefevre@example.com"
}'using HttpClient client = new();
using HttpRequestMessage request = new(HttpMethod.Post, "https://staging-api.docage.com/Contacts");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Content = new StringContent("""
{
"ParentOrganizationId": "5c6d7e8f-0000-4000-8000-000000000042",
"FirstName": "Hugo",
"LastName": "Lefèvre",
"Email": "hugo.lefevre@example.com"
}
""", 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: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"ParentOrganizationId": "5c6d7e8f-0000-4000-8000-000000000042",
"FirstName": "Hugo",
"LastName": "Lefèvre",
"Email": "hugo.lefevre@example.com"
})
});
const text = await response.text();
if (!response.ok) throw new Error(text);
const result = text ? JSON.parse(text) : null;C'est permis dans l'organisation de l'utilisateur, et dans une organisation cliente qu'il administre — le cas d'un
intégrateur, qui gère les organisations de ses clients. Ailleurs, la création est refusée (400, « Vous n'avez pas le droit
de créer dans cette organisation »).
Une exception : la création d'un parcours en une requête (POST https://staging-api.docage.com/Transactions/CreateFullTransaction) crée toujours dans
l'organisation de l'utilisateur authentifié : pour une organisation cliente, faites l'appel avec un utilisateur de cette organisation.
Lire les fiches d'une organisation
La liste d'un type rend tout ce que l'utilisateur voit, toutes organisations confondues. OrganizationId la restreint à une
organisation :
QUERY https://staging-api.docage.com/Contacts
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9…
Content-Type: application/json
{ "OrganizationId": "5c6d7e8f-0000-4000-8000-000000000042", "Take": 50 }curl -X QUERY "https://staging-api.docage.com/Contacts" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9…" \
-H "Content-Type: application/json" \
-d '{
"OrganizationId": "5c6d7e8f-0000-4000-8000-000000000042",
"Take": 50
}'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("""
{
"OrganizationId": "5c6d7e8f-0000-4000-8000-000000000042",
"Take": 50
}
""", 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({
"OrganizationId": "5c6d7e8f-0000-4000-8000-000000000042",
"Take": 50
})
});
const text = await response.text();
if (!response.ok) throw new Error(text);
const result = text ? JSON.parse(text) : null;GET https://staging-api.docage.com/Organizations rend les organisations que l'utilisateur a le droit de voir, et GET https://staging-api.docage.com/Organizations/{id}
l'une d'elles. L'intégrateur d'une organisation est dans son IntegratorId, que seule la plateforme écrit.
Une connexion par utilisateur
Chaque appel agit au nom de l'utilisateur authentifié, avec ses droits : un intégrateur qui sert plusieurs clients le fait avec ses propres utilisateurs, selon les droits qu'ils ont sur chaque organisation. Voir S'authentifier pour les connexions simultanées, et Droits et visibilité.