Liste / recherche des destinataires
Pour un explication de la hiérarchie, consulter la page Présentation de la rubrique Contacts
Liste des contacts avec leur destinataires
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer <token>");
var app_id = 1; // votre app id
// pagination recommandée
var limit = 1 // valeur par défaut de 25
var offset = 0 // va prendre limit contacts à partir de 0
var contact_types = "organizations" // type de contact organizations | persons
var request_params = `expand[]=establishments&expand[]=establishments.contacts&limit=${limit}&offset=${offset}`;
var requestOptions = {
method: 'GET',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch(`https://api.sinao.app/v1/apps/${app_id}/${contact_types}?${request_params}`, requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
"data": [
{
"id": 27844,
"name": "Sinao",
"billing_name": "SINAO",
"image": "/services/avatar/Sinao/S",
"legal_form": "SAS",
"country_iso2": "FR",
"founding_date": "2015-04-26T22:00:00.000000Z",
"founding_location": null,
"dissolution_date": null,
"duns": null,
"national_id": "811340728",
"tax_id": null,
"vat_id": "FR32811340728",
"code_naf": "6201Z",
"number_of_employees": "1 ou 2 salariés",
"slogan": null,
"rcs": null,
"greffe": null,
"capital": null,
"vat_system": null,
"closeaccounting_period": null,
"deleted_at": null,
"created_at": "2022-07-15T05:39:49.000000Z",
"updated_at": "2023-08-15T07:53:08.000000Z",
"metadata": null,
"sirene_data": null,
"type": "organization",
"establishments": [
{
"id": 1050,
"name": null,
"emails": [],
"websites": null,
"phones": [],
"nic": "00047",
"is_headquarters": 0,
"is_favorite": null,
"details": null,
"created_at": "2023-08-15T15:52:27.000000Z",
"updated_at": "2023-08-15T15:52:27.000000Z",
"place": {
"id": 862,
"latitude": "45.1769555",
"longitude": "5.7333869",
"street_number": "29",
"route": "Chemin de l'Église",
"route2": null,
"locality": "Grenoble",
"sublocality": null,
"administrative_area_level_3": null,
"administrative_area_level_2": "Isère",
"administrative_area_level_1": "Auvergne-Rhône-Alpes",
"country": "France",
"countryiso2": null,
"postal_code": "38100",
"type": null,
"created_at": "2023-08-15T15:52:27.000000Z",
"updated_at": "2023-08-15T15:52:27.000000Z",
"formatted_address": "29 Chemin de l'Église - 38100 Grenoble - France",
"short_postal_code": "38",
"exported_address": "29 Chemin de l'Église"
},
"contacts": [
{
"id": 408,
"name": "Contact",
"job": "Support",
"phone": null,
"email": "[email protected]"
}
]
}
]
}
]
Rechercher un / des contacts
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer <token>");
var app_id = 1; // votre app id
// pagination recommandée
var limit = 25 // valeur par défaut de 25
var offset = 0 // va prendre limit contacts à partir de 0
var search = "sinao";
var contact_types = "organizations" // type de contact organizations | persons
var request_params = `expand[]=establishments&search=${search}&expand[]=establishments.contacts&limit=${limit}&offset=${offset}`;
var requestOptions = {
method: 'GET',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch(`https://api.sinao.app/v1/apps/${app_id}/${contact_types}?${request_params}`, requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
"data": [
{
"id": 27844,
"name": "Sinao",
"billing_name": "SINAO",
"image": "/services/avatar/Sinao/S",
"legal_form": "SAS",
"country_iso2": "FR",
"founding_date": "2015-04-26T22:00:00.000000Z",
"founding_location": null,
"dissolution_date": null,
"duns": null,
"national_id": "811340728",
"tax_id": null,
"vat_id": "FR32811340728",
"code_naf": "6201Z",
"number_of_employees": "1 ou 2 salariés",
"slogan": null,
"rcs": null,
"greffe": null,
"capital": null,
"vat_system": null,
"closeaccounting_period": null,
"deleted_at": null,
"created_at": "2022-07-15T05:39:49.000000Z",
"updated_at": "2023-08-15T07:53:08.000000Z",
"metadata": null,
"sirene_data": null,
"type": "organization",
"establishments": [
{
"id": 1050,
"name": null,
"emails": [],
"websites": null,
"phones": [],
"nic": "00047",
"is_headquarters": 0,
"is_favorite": null,
"details": null,
"created_at": "2023-08-15T15:52:27.000000Z",
"updated_at": "2023-08-15T15:52:27.000000Z",
"place": {
"id": 862,
"latitude": "45.1769555",
"longitude": "5.7333869",
"street_number": "29",
"route": "Chemin de l'Église",
"route2": null,
"locality": "Grenoble",
"sublocality": null,
"administrative_area_level_3": null,
"administrative_area_level_2": "Isère",
"administrative_area_level_1": "Auvergne-Rhône-Alpes",
"country": "France",
"countryiso2": null,
"postal_code": "38100",
"type": null,
"created_at": "2023-08-15T15:52:27.000000Z",
"updated_at": "2023-08-15T15:52:27.000000Z",
"formatted_address": "29 Chemin de l'Église - 38100 Grenoble - France",
"short_postal_code": "38",
"exported_address": "29 Chemin de l'Église"
},
"contacts": [
{
"id": 408,
"name": "Contact",
"job": "Support",
"phone": null,
"email": "[email protected]"
}
]
}
]
}
]
Updated about 1 year ago