Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
feat: First endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Aug 24, 2017
1 parent 0491005 commit 5351b4b
Show file tree
Hide file tree
Showing 8 changed files with 716 additions and 43 deletions.
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#
# Warning

This library is WIP, created to develop Flyve MDM.

# How to install

Expand All @@ -12,4 +14,20 @@ composer require glpi-project/rest-api-client
use GlpiProject\API\Rest\Client;
use GuzzleHttp\Client as HttpClient;

$client = new Client.php(new HttpClient(['base_uri' => "http://localhost/glpi/apirest.php/"]));
// Instanciate the API client
$client = new Client(new HttpClient(), 'http://localhost/glpi/apirest.php/');

// Authenticate
if (!$client->initSessionByCredentials('glpi', 'glpi')) {
die('failed to authenticate');
}

// The client handles the session token for you (app token not yet supported)

// do something
try {
$response = $client->computer('post', ['name' => 'computer 0001']);
} catch (\Exception $e) {
// Handle here HTTP >= 400
}
```
57 changes: 29 additions & 28 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
{
"name" : "glpi-project/rest-api-client",
"type" : "library",
"description" : "Client for GLPI rest API",
"keywords" : [
"GLPI",
"rest",
"name" : "glpi-project/rest-api-client",
"type" : "library",
"description" : "Client for GLPI rest API",
"keywords" : [
"GLPI",
"rest",
"api",
"client"
],
"homepage" : "https://github.com/glpi-project/rest-api-client",
"license" : "GPL-3.0+",
"authors" : [{
"name" : "Thierry Bugier",
"email" : "[email protected]",
"role" : "Developer"
}
],
"require" : {
"php" : ">=5.6.0",
"guzzlehttp/guzzle": "^6.3"
},
"require-dev" : {
"atoum/atoum" : "^3.1"
},
"autoload" : {
"psr-4" : {
"GlpiProject\\API\\Rest\\" : "src/GlpiProject/API/Rest/"
}
}
}
],
"homepage" : "https://github.com/glpi-project/rest-api-client",
"license" : "GPL-3.0+",
"authors" : [{
"name" : "Thierry Bugier",
"email" : "[email protected]",
"role" : "Developer"
}
],
"require" : {
"php" : ">=5.6.0",
"guzzlehttp/guzzle" : "^6.3"
},
"require-dev" : {
"atoum/atoum" : "^3.1"
},
"autoload" : {
"psr-4" : {
"GlpiProject\\API\\Rest\\" : "src/GlpiProject/API/Rest/",
"GlpiProject\\API\\Rest\\Exception\\" : "src/GlpiProject/API/Rest/Exception/"
}
}
}
Loading

0 comments on commit 5351b4b

Please sign in to comment.