Rechercher un client

Un client peut être une personne (particulier) ou une organisation (entreprise), pour rechercher un particulier vous devez utiliser /apps/:appId/persons et pour une entreprise /apps/:appId/organizations.

Pour rechercher une personne (particulier) :

Deux options s'offre à vous la première vous pouvez recherche par l'id de votre particulier. Si vous ne disposez pas de l'id du particulier, vous pouvez réaliser une requête filtrée.

Pour la recherche par nom de famille :

var myHeaders = new Headers();

myHeaders.append("Authorization", "Bearer <token>");

var formdata = new FormData();

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

fetch("https://api.sinao.app/v1/apps/:appId/persons/:id?expand[]=relationship&filters[0][name]=lastname&filters[0][comparator]=LIKE&filters[0][value]=:nom_de_famille", requestOptions)
		.then(response => response.text())
		.then(result => console.log(result))
		.catch(error => console.log('error', error));
{
    "data": [
        {
            "id": 41,
            "civility": "M",
            "lastname": "Test",
            "firstname": "Client",
            "image": "/services/avatar/ClientTest/CT",
            "metadata": null,
            "deleted_at": null,
            "created_at": "2023-10-18T07:46:01.000000Z",
            "updated_at": "2023-10-18T07:46:01.000000Z",
            "civil_name": "M Test",
            "name": "Client Test",
            "initials": "CT",
            "type": "person",
            "relationship": {
                "id": 53,
                "is_customer": null,
                "is_supplier": null,
                "is_prospect": null,
                "main_contact_person": null,
                "referring_commercial": null,
                "importance_level": null,
                "rating": null,
                "is_notifying": null,
                "note": null,
                "contactplace": null,
                "tags": [],
                "discount": null,
                "details": null,
                "payment_swift": "BDFEFRPPCCT",
                "payment_iban": "FR7630001007941234567890185",
                "payment_period": null,
                "payment_methods": null,
                "metadata": null,
                "created_at": "2023-10-18T07:46:01.000000Z",
                "updated_at": "2023-10-23T12:31:36.000000Z",
                "deleted_at": null,
                "accounting_infos": {
                    "balance_initial_amount": null,
                    "reference": null,
                    "customer_id": null,
                    "supplier_id": null,
                    "accounting_number_customer": "411",
                    "accounting_number_supplier": "401"
                },
                "contact_type": "person"
            }
        },
    ],
}

Pour la recherche avec id :

var myHeaders = new Headers();

myHeaders.append("Authorization", "Bearer <token>");

var formdata = new FormData();

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

fetch("https://api.sinao.app/v1/apps/:appId/persons/:id?expand[]=relationship", requestOptions)
		.then(response => response.text())
		.then(result => console.log(result))
		.catch(error => console.log('error', error));
{
    "id": 41,
    "civility": "M",
    "lastname": "Test",
    "firstname": "Client",
    "image": "/services/avatar/ClientTest/CT",
    "metadata": null,
    "deleted_at": null,
    "created_at": "2023-10-18T07:46:01.000000Z",
    "updated_at": "2023-10-18T07:46:01.000000Z",
    "civil_name": "M Test",
    "name": "Client Test",
    "initials": "CT",
    "type": "person",
    "relationship": {
        "id": 53,
        "is_customer": null,
        "is_supplier": null,
        "is_prospect": null,
        "main_contact_person": null,
        "referring_commercial": null,
        "importance_level": null,
        "rating": null,
        "is_notifying": null,
        "note": null,
        "contactplace": null,
        "tags": [],
        "discount": null,
        "details": null,
        "payment_swift": null,
        "payment_iban": null,
        "payment_period": null,
        "payment_methods": null,
        "metadata": null,
        "created_at": "2023-10-18T07:46:01.000000Z",
        "updated_at": "2023-10-18T07:46:01.000000Z",
        "deleted_at": null,
        "accounting_infos": {
            "balance_initial_amount": null,
            "reference": null,
            "customer_id": null,
            "supplier_id": null,
            "accounting_number_customer": "411",
            "accounting_number_supplier": "401"
        },
        "contact_type": "person"
    }
}