Skip to content

Latest commit

 

History

History
94 lines (71 loc) · 2.25 KB

index.rst

File metadata and controls

94 lines (71 loc) · 2.25 KB

Index

Basic Usage

Setup client:

require 'vendor/autoload.php';

use Onetoweb\Monday\Client as MondayClient;

// param
$apiKey = 'api_key';

// setup client
$client = new MondayClient($apiKey);

Endpoints

You can use one of the built in endpoints see examples below:

Build your own payload

You can fetch data by building a query payload:

use Onetoweb\Monday\Payload\Payload;

// example selecting boards, items, subitems and updates
$payload = new Payload('query', [], [
    new Payload('boards', ['limit' => 5, 'page' => 0], ['id', 'name',
        new Payload('items_page', ['limit' => 3], [
            'cursor', // contains cursor token to load the next item page
            new Payload('items', [], ['id', 'name',
                new Payload('subitems', [], ['id', 'name',
                    new Payload('updates', [], ['body'])
                ])
            ])
        ])
    ])
]);

$result = $client->request($payload);

You can manipulate data by building a mutation payload:

use Onetoweb\Monday\Payload\Payload;

// create board
$payload = new Payload('mutation', [], [
    new Payload('create_board', [
        'board_name' => 'new board created via api',
        'board_kind' => 'public',
        'description' => 'board description'
    ], ['id'])
]);

$result = $client->request($payload);