Ajout d’un contact¶
Ce web-service permet d’ajouter un contact en PHyC.
Paramètres HTTP¶
Paramètre |
Valeur |
|---|---|
Route |
contact |
Méthode |
POST |
Contenu |
contact au format json |
Droit de gestion¶
Il faut être gestionnaire d’une zone hydro pour ajouter un contact.
Profil du contact¶
Les valeurs possibles du profil du contact sont:
000 : profil public
001 : profil institutionnel
011 : profil modélisateur et institutionnel
111 : profil administrateur national
Le choix des profils du nouveau contact est limité par le profil de l’utilisateur du web-service.
Profil de l’utilisateur |
Choix de profils pour le nouveau contact |
|---|---|
public |
Public |
institutionnel |
Public (000) ou institutionnel (001) |
institutionnel+modélisateur |
Public (000) ou institutionnel (001) ou institutionnel+modélisateur (011) |
Administrateur national |
Public (000) ou institutionnel (001) ou institutionnel+modélisateur (011) ou administrateur national (111) |
Contenu de la requête HTTP¶
La requête HTTP doit contenir un json hydrométrie contenant un contact.
Json hydrométrie¶
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://phyc.org/ws/ajouterContact.json",
"type": "object",
"properties": {
"Scenario": {
"type": "object"
},
"RefHyd": {
"type": "object",
"properties": {
"Intervenants": {
"type": "array",
"items": {
"type": "object",
"properties": {
"CdIntervenant": {"type": "string"},
"schemeAgencyID": {
"type": "string",
"enum": ["SANDRE", "SIRET"]
},
"Contacts": {
"type": "array",
"items": {
"type": "object",
"properties": {
"CdContact": {"type": "string", "const": "--"},
"NomContact": {"type": "string"},
"PrenomContact": {"type": "string"},
"CiviliteContact": {"type": "integer", "enum": [1, 2, 3]},
"ProfilContact": {"type": "string", "enum": ["000", "001", "011", "111"]},
"AdContact": {"type": "string"},
"AdEtrangereContact": {"type": "string"},
"CpContact": {"type": "string"},
"VilleContact": {"type": "string"},
"FonctionContact": {"type": "string"},
"TelephoneContact": {"type": "string"},
"PortContact": {"type": "string"},
"FaxContact": {"type": "string"},
"MelContact": {"type": "string"},
"PaysContact": {"type": "string"},
"AliasContact": {"type": "string"},
"DtDesactivationContact": {"type": "string", "format": "date-time"}
},
"required": ["CdContact", "NomContact", "PrenomContact", "MelContact"],
"additionalProperties": false
},
"minItems": 1
}
},
"required": ["CdIntervenant"],
"additionalProperties": false
},
"minItems": 1,
"maxItems": 1
}
},
"required": ["Intervenants"],
"additionalProperties": false
}
},
"required": ["Scenario", "RefHyd"],
"additionalProperties": false
}
Les attributs RefHyd (associé à l’objet Refhyd) et Scenario sont obligatoires;
L’objet RefHyd ne doit contenir qu’un seul attribut Intervenants associé à une liste ne contenant qu’un seul objet Intervenant;
L’objet Intervenant doit contenir les attributs CdIntervenant et Contacts;
L’attribut Contacts doit être une liste non vide contenant des objets Contact;
L’attribut CdContact de l’objet Contact doit OBLIGATOIREMENT avoir la valeur « – » (tiret-tiret);
L’objet Contact ne doit pas contenir les attributs DateMajContact, ProfilsAdminLocal, MotPassContact,DtActivationContact;
Réponse du web-service¶
En cas de succès, le web-service retournera un json hydrométrie contenant le contact ajouté.
Le web-service rajoutera les attributs suivants au contact:
CdContact : code du contcta
DateMajContact : date de mise en base du contact