Projet

Général

Profil

Actions

Se connecter à l'API DoliSCAN depuis Dolibarr

Premier test aujourd'hui un peu brutal qui marche:

        $token = "w0ymfx2UWsazq1JtUWDrC1l0HNxJOl9BqLVtOqk83Z82aCwvVfDtlBBKo5Y6";
        $headers = [
                    'Authorization' => 'Bearer ' . $token,
                    'Accept'        => 'application/json',
                    ];

        $client = new GuzzleHttp\Client([
                                              'base_uri' => 'http://192.168.16.15/',                                                                                                                                                                                                                                      
                                              'timeout'  => 2.0,
                                              'headers'  => $headers,
                                              ]);

        $response = $client->request('POST', 'api/ping', [
                                                          'json' => ['email' => 'tar@cap-rel.fr']
                                                          ]);
        //        xhr.setRequestHeader('Authorization', 'Bearer ' + localGetData("api_token"));                                                                                                                                                                                                                           

        print_r($response);

Mis à jour par Eric Seigne il y a presque 4 ans · 1 révisions

Go to top
Ajouter une image à partir du presse-papier (Taille maximale: 50 Mo)