So I’m a bit later than normal with blogging, that’s mostly because I was working on this project a little longer than usual. Autotask recently released update 2020.2 and this update includes a new REST API.
This is super cool, because the old API was a SOAP api and terribly inconvenient to actively use. To help people with using the new Autotask API I’ve created a module. The module is still in alpha/beta but you can download it from the PSGallery now.
The project page is here. Feel free to report any issues or do a pull request if you want to help develop the module! Just be prepared for breakage in the first couple of weeks, I’m still working on finding the best methods 🙂
Installation instructions
The module is published to the PSGallery, download it using:
|
|
Usage
To get items using the Autotask API you’ll first have to add the authentication headers using the Add-AutotaskAPIAuth
function.
|
|
When the command runs, You will be asked for credentials. Using these we will try to decide the correct webservices URL for your zone based on the email address. If this fails you must manually set the webservices URL.
|
|
The Base URI value has tab completion to help you find the correct one easily.
To find resources using the API, execute the Get-autotaskAPIResource function. For the Get-AutotaskAPIResource function you will need either the ID of the resource you want to retrieve, or the JSON SearchQuery you want to execute.
Examples
To find the company with ID 12345
|
|
To get all companies that are Active:
|
|
To create a new company, we can either make the entire JSON body ourselves, or use the New-AutotaskBody function.
|
|
This creates a body for the model Company. Definitions can be tab-completed. The body will contain all expected values. If you want an empty body instead use:
|
|
After setting the values for the body you want, execute: New-AutotaskAPIResource -Resource Companies -Body $body
Contributions
Feel free to send pull requests or fill out issues when you encounter any.