PHP code example of interworks / thoughtspotrest

1. Go to this page and download the library: Download interworks/thoughtspotrest library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

interworks / thoughtspotrest example snippets


$ts->searchMetadata($args);

use InterWorks\ThoughtSpotREST\ThoughtSpotREST;

// Instantiate
$ts = new ThoughtSpotREST();

// Get first 10 Liveboards and create a collection.
$liveboards = $ts->searchMetadata(['metadata' => ['type' => 'LIVEBOARD'], 'record_size' => 10]);
$liveboards = collect($liveboards);

// Get a user by name and update it
$users  = $ts->searchUsers(['user_identifier' => 'jlyons', 'record_size' => 1]);
$user   = collect($users)->first();
$userID = $user['id'];
$ts->updateUser($userID, ['email' => '[email protected]']);

$response = $ts->call(
    url   : 'metadata/search',
    args  : ['metadata' => ['type' => 'LIVEBOARD'], 'record_size' => 10],
    method: 'POST'
);
$response->json();

$ts         = new ThoughtSpotREST(returnResponseObject: true);
$response   = $ts->searchMetadata(['metadata' => ['type' => 'LIVEBOARD'], 'record_size' => 10]);
$success    = $response->successful();
$body       = $response->body();
$liveboards = $response->json();