Home / Selection / All rows

Selection ‐ All rows


Getting all rows from the selection

Endpoint

GET /api/selection/:selectionId/page/:pageNr[/rows/:numberOfRows]

Parameters:

  • :selectionId - id of the selection of which we want to obtain data
  • :pageNr - page number
  • :numberOfRows - how many rows per page we want to get

Headers

see Using authentication token

Response

  • Valid response contains properties valid (with value set to true obviously), data with an array of found rows, extra with some additional info (check Getting random row from the selection for the meaning of extra.email_field.field_name property) and pag ination. Pagination can contain following fields:
    • next_page - if there's more than 1 page of results this will contain number of the next page (if there's no next page this property won't exist)
    • has_next_page - if there's next page after the current one (if there's no next page this property won't exist)
    • rows_per_page - number of rows per page
    • total_rows - total number of rows
    • total_pages - total number of pages
  • Invalid response: See Invalid response in Standard response rules
  • Example valid response:

        {
            "valid": true,
            "data": {
                "table_name.field": "field@value"
            }, "extra": {
               "email_field": {
                   "field_name": "table_name.field"
                } 
            }
        }

Example code:

<?php

require_once 'RestOpen.php';

$username = 'my_username';
$password = 'my_password';
$workspaceId = 999;
$selectionId = 999;
$page = 0; //not mandatory in this method
$rows = 200 //not mandatory in this method

$rest = new RestOpen($username, $password, $workspaceId);
$result = $rest->getSelectionAllRows($selectionId, $page, $rows);

var_dump($result);