Download the PHP package footbridge-media/accelo-php-sdk without Composer
On this page you can find all versions of the php package footbridge-media/accelo-php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package accelo-php-sdk
Accelo PHP SDK
An Unofficial, PHP 8.1+ Accelo PHP SDK created by Footbridge Media developer Garet C. Green.
Requirements
- Guzzle 7.4 and above
- PHP 8.1 and above
Usage
First, you must setup authentication and credentials before requests will be successfully processed.
Install using composer
Authenticate Your Accelo Account via oAuth for Web Application Use
This library comes with a built-in authenticator for CLI use that will allow you to authenticate your Accelo staff account with the oAuth2 API they have.
Make sure to have your Deployment Name, Client ID, and Client Secret handy and then run the following script via the CLI.
Follow the prompts and provide the information they request until it outputs a URL.
Copy the full URL and visit it in a web browser.
Sign in to your Accelo account by following the link, and it will give you a numerical access code. Return to the CLI prompt where it asks you for this access code.
You will then be given the necessary access_token and refresh_token to use with this library and the Accelo API.
Save your two tokens (access and refresh) for use in this library below. Usually you would store them in a non-committed environment file.
You may also wish to store the expires_in and expires_on information so you know when you need to renew your tokens. You can now continue to utilizing the rest of this library below.
Authenticating a Service Application
If you wish you use a service application instead of authenticating a web user, the process is similar to the above authentication section.
Make sure to have your Deployment Name, Client ID, and Client Secret handy and then run the following script via the CLI. Run this script from your application's root.
Follow the prompts and provide the information they request.
If all the information is correct, then Accelo's oAuth API will authorize your application for 3 years. You will then be given the necessary access_token to use with this library and the Accelo API.
You will only need to use the access_token for a service application.
You may also wish to store the expires_in and expires_on information so you know when you need to renew your tokens. You can now continue to utilizing the rest of this library below.
Initiate a New Accelo Object
This object will be given an authentication object and a credentials object. Then it will be used to call the API.
Client Authentication Object
Currently, only the web authentication is supported. However, there is the framework already paved for later implementations using a service authentication method.
Client Credentials Object
Registering Authentication and Credentials
Now, register both the authentication and credentials instances with the Accelo object.
API Call Types
As of this README and library version, the list
type of API calls is implemented with all available filters, searches, and extra field parameters supported.
Listing Companies
The following is an example of listing companies with a provided filter and search.
Paginating Results
Accelo's maximum limit on returned results is 100 entries of any object. The default is 10. You can specify which page and what limit you want the list calls to return with a Paginator object. Shown below. We request all companies to be returned with a limit of 15 each API call. Additionally, there is a filter to order them by name in ascending order.
As you can see at the bottom, you can use the hasMorePages boolean flag to tell if a response probably has more results to return. Then you would increment the paginator with incrementPage. You can then make the same API call with the same object filters, fields, and same paginator instance but you will receive new results.
Updating an Object
Below is an example of updating the name of a company. You can use this pattern for any updatable object (issues, contacts, etc). The request response will have a new instance of the updated object.
The response will follow the Accelo API's return of default fields only. The additionalFields parameter to return have the newly returned object have additional fields hydrated.
Creating an Object
Creating an object is syntatically similar to updating existing objects. Again, use additionalFields to have the API response contain hydrated fields that are outside the default.
This example will create a new company that is, by default, set to Inactive standing.
Deleting an object
Deleting an object doesn't return a resource, so no objectType needs to be passed in. Not all objects can be deleted.
Run a Progression
Currently, progression running is only implemented for issues (tickets). runProgression
is a method on the object itself. It takes a dependency-injected Accelo object.
Generally, you would use an existing object to call the progression on; however just like the example shows below, you can just make a blank new object with a populated ID and it will work fine.
The runProgression
's response will follow the Accelo API's pattern in returning the progressed object from the API response. This means you can supply an additionalFields parameter for the returned object to have more than just the default fields.
Modifying API URL for Mock Server Testing
You can modify the base API URL and/or version string that the requests will be sent to in order to setup mock servers for API testing.
The Accelo object has the following methods to set and get the API base URL (do not include an appended forward slash) and the API version string (E.g. "v0"):
By default, you do not need to set these as they are defined for you. If you want to override these, do so before making requests against any methods. Additionally, this naturally overrides the oAuth API endpoint.