Hello,
I am trying to use the kanboard API with PHP to do some tests. I successfully tested with cURL, but I’m having trouble getting started with a jsonRPC client.
I need help just to get started. If any of you can show me a snippet of calling code, I think it will unblock me.
my code :
<?php
require __DIR__ . '/vendor/autoload.php';
defined('KB_URL') or define('KB_URL', "https://kb_demo.my.local");
defined('KB_TOKEN') or define('KB_TOKEN', "123123123123123123123123123123123123");
use JsonRPC\Client;
$client = new Client(KB_URL);
/*
* First call : ok
*/
$result = $client->getHttpClient()
->withDebug()
->withUsername('jsonrpc')
->withPassword(KB_TOKEN);
print_r($result);
/*
* second call : Ko
*/
$result = $client->getHttpClient()
->getAllProjects()
->withUsername('jsonrpc')
->withPassword(KB_TOKEN)
;
print_r($result);
I Progress , and now, I think my problem is arround autentication with JsonRPC for a site where ssl certificate is selfsigned … (develop environnement)
echo "\n####################### Sample with JsonRPC Client => debug ################################\n";
/*
* Sample with JsonRPC Client => debug
*/
defined('KB_URL') or define('KB_URL', "https://kb_demo.my.local/jsonrpc.php");
defined('KB_TOKEN') or define('KB_TOKEN', "12312312312331313131311313365645");
$client = new JsonRPC\Client(KB_URL);
$result = $client->getHttpClient()
->withDebug()
->withUsername('jsonrpc')
->withPassword(KB_TOKEN)
->withoutSslVerification();
print_r($result);
echo "\n########################## Sample getAllProjects() => KO #################################\n";
print_r( $client->getAllProjects() );