PHP code example of survos / platform-api-php

1. Go to this page and download the library: Download survos/platform-api-php 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/ */

    

survos / platform-api-php example snippets




use Survos\Client\SurvosClient;

$client = new SurvosClient('https://demo.survos.com/api1.0/');
if (!$client->authorize('otest', 'tt')) {
    throw new \Exception('Wrong credentials!');
}

use Survos\Client\Resource\UserResource;

$data = [
    'username' => 'john85210101',
    'email' => '[email protected]',
    'name' => 'Nick',
];
$resource = new UserResource($client);;
if ($resource->register($data)) {
    //user has been created
}

$item = $resource->getById($id);

$page = 1;
$maxPerPage = 10;
$criteria = ['id' => $id];
$orderBy = ['id' => 'asc'];
$response = $resource->getList($criteria, $orderBy, $page, $maxPerPage);

$result = $resource->deleteById($id);