PHPackages                             onbalt/servicedeskplus-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. onbalt/servicedeskplus-api

ActiveLibrary[API Development](/categories/api)

onbalt/servicedeskplus-api
==========================

Laravel integration with ManageEngine ServiceDesk Plus API

v1.2(6y ago)71352MITPHPPHP &gt;=5.6

Since Jul 29Pushed 6y ago2 watchersCompare

[ Source](https://github.com/onbalt/servicedeskplus-api)[ Packagist](https://packagist.org/packages/onbalt/servicedeskplus-api)[ RSS](/packages/onbalt-servicedeskplus-api/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (3)Versions (4)Used By (0)

Integration with ManageEngine ServiceDesk Plus API
==================================================

[](#integration-with-manageengine-servicedesk-plus-api)

[![Latest Stable Version](https://camo.githubusercontent.com/529f64152e1578bbdaf6a4ffa27d7dd52161683edc213e5a63f17808f9c066dd/68747470733a2f2f706f7365722e707567782e6f72672f6f6e62616c742f736572766963656465736b706c75732d6170692f76657273696f6e)](https://packagist.org/packages/onbalt/servicedeskplus-api)[![Total Downloads](https://camo.githubusercontent.com/ce2cb5c05f6c56c1ec9cf1a3b080841eb5669c7ed6e1b9505ba354e41124c2f6/68747470733a2f2f706f7365722e707567782e6f72672f6f6e62616c742f736572766963656465736b706c75732d6170692f646f776e6c6f616473)](https://packagist.org/packages/onbalt/servicedeskplus-api)[![Latest Unstable Version](https://camo.githubusercontent.com/f2dcb7ede4c509bb8965dd20bc00f41e01332b2271e6f06e1b04822265ad815a/68747470733a2f2f706f7365722e707567782e6f72672f6f6e62616c742f736572766963656465736b706c75732d6170692f762f756e737461626c65)](//packagist.org/packages/onbalt/servicedeskplus-api)[![License](https://camo.githubusercontent.com/8291875b9b915e7f2c43f433d967e23e12f0479efe3b0c482ddda898daf4417f/68747470733a2f2f706f7365722e707567782e6f72672f6f6e62616c742f736572766963656465736b706c75732d6170692f6c6963656e7365)](https://packagist.org/packages/onbalt/servicedeskplus-api)[![composer.lock available](https://camo.githubusercontent.com/7b672a136385904d658e00c8207f6d14e923b6dfae11412c026adaa5ee596986/68747470733a2f2f706f7365722e707567782e6f72672f6f6e62616c742f736572766963656465736b706c75732d6170692f636f6d706f7365726c6f636b)](https://packagist.org/packages/onbalt/servicedeskplus-api)

Installation
------------

[](#installation)

This is a Laravel package so you can install it via Composer. Run this command in your terminal from your project directory:

```
composer require onbalt/servicedeskplus-api
```

Laravel Configuration
---------------------

[](#laravel-configuration)

Below **Laravel 5.5** you have to call this package service in `config/app.php` config file. To do that, add this line in `app.php` in `providers` array:

```
Onbalt\ServicedeskplusApi\ServicedeskplusApiServiceProvider::class,
```

Below **Laravel 5.5** version to use facade you have to add this line in `app.php` to the `aliases` array:

```
'ServicedeskplusApi' => Onbalt\ServicedeskplusApi\Facades\ServicedeskplusApi::class,
```

Now run this command in your terminal to publish this package config:

```
php artisan vendor:publish --tag=servicedeskplus-api-config

```

after publishing your config file, open `config/servicedeskplus-api.php` and fill your SDP URL and [technician key](http://ui.servicedeskplus.com/APIDocs3/index.html#authentication):

```
return [
	'api_base_url' => env('SDPAPI_BASE_URL', 'http://helpdesk.local/api/v3/'),
	'technician_key' => env('SDPAPI_TECHNICIAN_KEY', 'key'),
	'api_version' => env('SDPAPI_VERSION', '3'),
	'api_v1_format' => env('SDPAPI_V1_FORMAT', 'json'),
	'timeout' => 60,
];
```

also you can add config parametrs in `.env` file:

```
SDPAPI_BASE_URL=http://helpdesk.local/api/v3/
SDPAPI_TECHNICIAN_KEY=YOUR_TECHNICIAN_KEY

```

Laravel Usage
-------------

[](#laravel-usage)

```
use Onbalt\ServicedeskplusApi\Facades\ServicedeskplusApi;

// View Request
$response = ServicedeskplusApi::get('requests/111');
var_dump($response->request);
```

Common Usage
------------

[](#common-usage)

Create and use an instance of a class ServicedeskplusApi instead of Facade:

```
require 'vendor/autoload.php';

use Onbalt\ServicedeskplusApi\ServicedeskplusApi;

$config = [
	'api_base_url' => 'http://helpdesk.local/api/v3/',
	'technician_key' => 'YOUR_TECHNICIAN_KEY',
	'api_version' => '3',
	'api_v1_format' => 'json',
	'timeout' => 60,
];

$sdpApi = new ServicedeskplusApi($config);

// View Request
$response = $sdpApi->get('requests/111');
var_dump($response->request);
```

Examples
--------

[](#examples)

### View Request

[](#view-request)

See:

```
$response = ServicedeskplusApi::get('requests/111');
var_dump($response);
```

```
object(stdClass)# (2) {
  ["request"]=>
  object(stdClass)# (50) {
    //
    //@see: http://ui.servicedeskplus.com/APIDocs3/index.html#request8
  }
  ["response_status"]=>
  object(stdClass)# (2) {
    ["status_code"]=>
    int(2000)
    ["status"]=>
    string(7) "success"
  }
}
```

### View all Requests

[](#view-all-requests)

See:

```
$inputData = ServicedeskplusApi::prepareJsonInputData([
	'list_info' => [ //@see: http://ui.servicedeskplus.com/APIDocs3/index.html#list-info
		'row_count' => 10, //max 100
		'start_index' => 1,
		'sort_field' => 'id',
		'sort_order' => 'asc',
		'get_total_count' => true,
		'search_criteria' => [
			[
				'field' => 'site.name',
				'condition' => 'eq',
				'value' => 'MyCompany',
			],
		],
	]
]);
$response = ServicedeskplusApi::get('requests', $inputData);
var_dump($response);
```

```
object(stdClass)# (3) {
  ["requests"]=>
  array(10) {
    [0]=>
    object(stdClass)# (15) {
      //
      //@see: http://ui.servicedeskplus.com/APIDocs3/index.html#view-all-requests
    }
    [1]=>
    //
  }
  ["response_status"]=>
  object(stdClass)# (2) {
    ["status_code"]=>
    int(2000)
    ["status"]=>
    string(7) "success"
  },
  ["list_info"]=>
  object(stdClass)# (8) {
    ["has_more_rows"]=>
    bool(true)
    ["get_total_count"]=>
    string(7) "true"
    ["total_count"]=>
    int(111)
    //
