PHP code example of interworks / sigmarest

1. Go to this page and download the library: Download interworks/sigmarest 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 / sigmarest example snippets


use InterWorks\SigmaREST\SigmaREST;

// Instantiate
$sigma = new SigmaREST();

// Get first 100 users and create a collection.
$users = $sigma->getMembers(['limit' => 100]);
$users = collect($users['entries']);

// Get first 10 workbooks, loop through each and get their sources
$workbooks = $sigma->getWorkbooks(['limit' => 10]);
$sources   = [];
foreach ($workbooks['entries'] as $workbook) {
    $sources[] = $sigma->getWorkbookSource($workbook['workbookId']);
}

$response = $sigma->call(
    url   : 'cool/unknown/endpoint',
    args  : ['name' => 'Cool thing'],
    method: 'POST'
);
$response->json();

$sigma    = new SigmaREST(returnResponseObject: true);
$response = $sigma->getMembers(['limit' => 100]);
$success  = $response->successful();
$body     = $response->body();
$users    = $response->json();