Liste des établissements des entreprises

Pour un explication de la hiérarchie, consulter la page Présentation de la rubrique 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 request_params = `expand[]=establishments&limit=${limit}&offset=${offset}`;

var requestOptions = {[
		method: 'GET',
		headers: myHeaders,
		body: raw,
		redirect: 'follow'
};

fetch(`https://api.sinao.app/v1/apps/${app_id}/organizations?${request_params}`, requestOptions)
		.then(response => response.text())
		.then(result => console.log(result))
		.catch(error => console.log('error', error));
"data": [
        {
            "id": 1,
            "name": "Client test",
            "billing_name": "Client test",
            "image": "/services/avatar/Clienttest/C",
            "legal_form": null,
            "country_iso2": "FR",
            "founding_date": null,
            "founding_location": null,
            "dissolution_date": null,
            "duns": null,
            "national_id": null,
            "tax_id": null,
            "vat_id": null,
            "code_naf": null,
            "number_of_employees": null,
            "slogan": null,
            "rcs": null,
            "greffe": null,
            "capital": null,
            "vat_system": null,
            "closeaccounting_period": null,
            "deleted_at": null,
            "created_at": "2021-09-30T15:44:50.000000Z",
            "updated_at": "2021-09-30T15:44:50.000000Z",
            "metadata": null,
            "sirene_data": null,
            "type": "organization",
            "establishments": [
                {
                    "id": 1,
                    "name": null,
                    "emails": [],
                    "websites": null,
                    "phones": [],
                    "nic": null,
                    "is_headquarters": 0,
                    "is_favorite": null,
                    "details": null,
                    "created_at": "2021-09-30T15:44:50.000000Z",
                    "updated_at": "2021-09-30T15:44:50.000000Z",
                    "place": {
                        "id": 1,
                        "latitude": "45.1882748",
                        "longitude": "5.7124913",
                        "street_number": "93",
                        "route": "Cours Berriat",
                        "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": "FR",
                        "postal_code": "38000",
                        "type": null,
                        "created_at": "2021-09-30T15:44:50.000000Z",
                        "updated_at": "2021-09-30T15:44:50.000000Z",
                        "formatted_address": "93 Cours Berriat - 38000 Grenoble - France",
                        "short_postal_code": "38",
                        "exported_address": "93 Cours Berriat"
                    }
                }
            ]
        },
...
]
  }