PHP code example of ne / api

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

    

ne / api example snippets




use Ne\Api\TokenHelper;
use Ne\Api\Client;

// Private key, copied from API management page
$private_key = '-----BEGIN PRIVATE KEY-----
[...]
-----END PRIVATE KEY-----';

// Generate JWT
$helper = new TokenHelper('[email protected]', $private_key);
$token = $helper->getToken('nonce123');

// Make request using JWT
$client = new Client($token);
$resp = $client->get(Client::ENDPOINT_PING, []);

var_dump($resp);