mralston / haloapi
Fork of derricksmith/haloapi. HaloApi is a PHP Wrapper for the HaloITSM API. This class supports all endpoints and methods available in the API.
Requires
- ext-curl: *
- ext-json: *
README
HaloAPI
HaloApi is a PHP Wrapper for the HaloITSM API. This class supports all endpoints and methods available in the API.
About The Project
HaloITSM is a powerful ITIL aligned IT Service Management tool. The REST API provides access to various information in the system. This wrapper was created to make calling the HaloITSM API easier and faster.
Getting Started
Prerequisites
The following PHP extensions are required:
- curl
- json
Usage
Install with Composer
composer require mralston/haloapi
Vanilla PHP
Instantiate the class with the following parameters. See the HaloITSM API documentation for more information.
client_id client_secret grant_type scope host verifypeer
$halo = new HaloApi([
'client_id' => '<your client id>',
'client_secret' => '<your client secret>',
'grant_type' => '<your grant type>',
'scope' => '<your scope>',
'host' => '<your Halo ITSM base URL>',
'verifypeer' => true
]);
Then call an endpoint method in the class.
$tickets = $halo->getTickets([
'pageinate' => true,
'page_size' => 50,
'page_no' => 1,
'columns_id' => 1,
'includecolumns' => false,
'ticketlinktype' => null,
'searchactions' => null,
'order' => 'id',
]);
// Returns array with response headers and data
[
"status": 200,
"header": ""
HTTP/2 200
date: Thu, 01 Jan 1970 00:00:00 GMT
content-type: application/json; charset=utf-8
content-length: 56
cache-control: no-cache, no-store, must-revalidate
server:
request-context: appId=cid-v1:aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
strict-transport-security: max-age=31536000; IncludeSubDomains; preload
referrer-policy: same-origin
permissions-policy: camera=(self),geolocation=(self)
"",
"data": {
"record_count": 0,
"tickets": [],
"include_children": false,
},
]
Laravel
The package contains an optional Laravel-specific service provider, config file & facade.
Once the package is installed, add the following variables to your .env file:
HALO_CLIENT_ID= HALO_CLIENT_SECRET= HALO_HOST=https://your-subdomain.haloitsm.com
Optionally, you can publish the config file:
php artisan vendor:publish --tag="halo-config"
You may then use the facade to interact with Halo:
use DerrickSmith\HaloApi\Facades\HaloApi; $tickets = HaloApi::getTickets([ 'pageinate' => true, 'page_size' => 50, 'page_no' => 1, 'columns_id' => 1, 'includecolumns' => false, 'ticketlinktype' => null, 'searchactions' => null, 'order' => 'id', ]); // Returns data object { "record_count": 0, "tickets": [], "include_children": false, }
Roadmap
-
Testing all api endpoints
-
Better error handling
See the open issues for a full list of proposed features (and known issues).
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!
-
Fork the Project
-
Create your Feature Branch (
git checkout -b feature/AmazingFeature
) -
Commit your Changes (
git commit -m 'Add some AmazingFeature'
) -
Push to the Branch (
git push origin feature/AmazingFeature
) -
Open a Pull Request
License
Distributed under the MIT License. See LICENSE.txt
for more information.
Contact
Derrick Smith - @derrick_a_smith - derricksmith01@msn.com
Project Link: https://github.com/derricksmith/HaloApi