Migration guide
This article will explain the main differences between the PowerShell modules EasitGoWebservice and Easit.GO.Webservice and also aims to help you migrate to the new module.
Differences
A fundamental difference between the modules is that EasitGoWebservice uses the SOAP based WebAPI (webservice) in Easit GO and Easit.GO.Webservice uses the REST based WebAPI for Easit GO. That means that instead of sending and retrieving XML, we now do so with JSON. The cmdlet actually transporting the requests and responses in the "old" module was Invoke-WebRequest, in the "new" module we use Invoke-RestMethod.
The biggest difference between EasitGoWebservice and Easit.GO.Webservice is that EasitGoWebservice is written for Windows PowerShell (Version 5.x) and Easit.GO.Webservice is written for PowerShell 7.x. Easit.GO.Webservice takes for example advantage of the -Parallel switch for ForEach-Object when needed while EasitGoWebservice uses a regular foreach ($item in $items) {code} approach. You might be able to use EasitGoWebservice on PowerShell 7.x, but you cannot use Easit.GO.Webservice on Windows PowerShell 5.x.
The second difference is that Easit.GO.Webservice supports piping and can take an array as input, allowing for sending objects in batches instead of one and one as in EasitGoWebservice.
A small "quality of life" improvement we made in EasitGoWebservice is that you no longer need to include the webservice path in the URL for Easit GO. Before: http://localhost/webservice/, Now: http://localhost/. In fact, if you provide a URL formatted like this http://localhost/webservice, the function will throw an error.
For getting items from Easit GO we have added a parameter to that function called GetAllPages. This parameter can be used to get all items from all pages in a view.
Support for a local configuration file have been removed in the new module.
Comparison
Sending
EasitGoWebservice (Windows Powershell 5.x)
| $importEasitItem = @{
url = 'https://go.easit.com/webservice/'
api = 'myApikey'
ImportHandlerIdentifier = 'myImportHandler'
}
$adObjects = Get-ADUser -Filter * -SearchBase 'OU=RootOU,DC=company,DC=com'
foreach ($adObject in $adObjects) {
$customItem = @{prop1="$($adObject.prop1)";prop2="$($adObject.prop2)";prop3="$($adObject.prop3)"}
Import-GOCustomItem @importEasitItem -CustomProperties $customItem
}
|
Easit.GO.Webservice (PowerShell 7.x)
| $sendToEasitParams = @{
Url = 'https://go.easit.com'
Apikey = 'myApikey'
ImportHandlerIdentifier = 'myImportHandler'
}
Send-ToEasitGO @sendToEasitParams -Item (Get-ADUser -Filter * -SearchBase 'OU=RootOU,DC=company,DC=com')
|
Get item / objects
EasitGoWebservice (Windows Powershell 5.x)
| $getGoItemsParams = @{
url = 'http://go.easit.com/webservice/'
api = 'myApikey'
view = 'myWebserviceView'
}
Get-GOItems @getGoItemsParams
|
Easit.GO.Webservice (PowerShell 7.x)
| $getEasitGOItemParams = @{
Url = 'https://go.easit.com'
Apikey = 'myApikey'
ImportViewIdentifier = 'myWebserviceView'
}
Get-EasitGOItem @getEasitGOItemParams
|
Get item / objects - Filtering
EasitGoWebservice (Windows Powershell 5.x)
| $getGoItemsParams = @{
url = 'http://go.easit.com/webservice/'
api = 'myApikey'
view = 'myWebserviceView'
ColumnFilter = 'Status,81:1,IN,'
}
Get-GOItems @getGoItemsParams
|
Easit.GO.Webservice (PowerShell 7.x)
| $columnFilter = New-ColumnFilter -ColumnName 'Status' -RawValue '81:1' -Comparator 'IN'
$getEasitGOItemParams = @{
Url = 'https://go.easit.com'
Apikey = 'myApikey'
ImportViewIdentifier = 'myWebserviceView'
ColumnFilter = $columnFilter
}
Get-EasitGOItem @getEasitGOItemParams
|
Get item / objects - Sorting
EasitGoWebservice (Windows Powershell 5.x)
| $getGoItemsParams = @{
url = 'http://go.easit.com/webservice/'
api = 'myApikey'
view = 'myWebserviceView'
sortOrder = 'Descending'
sortField = 'Id'
}
Get-GOItems @getGoItemsParams
|
Easit.GO.Webservice (PowerShell 7.x)
| $sortColumn = New-SortColumn -Name 'Id' -Order 'Descending'
$getEasitGOItemParams = @{
Url = 'https://go.easit.com'
Apikey = 'myApikey'
ImportViewIdentifier = 'myWebserviceView'
SortColumn = $sortColumn
}
Get-EasitGOItem @getEasitGOItemParams
|
Get datasource
EasitGoWebservice (Windows Powershell 5.x)
Easit.GO.Webservice (PowerShell 7.x)
| $getDatasourceFromEasitGO = @{
Url = 'https://go.easit.com'
Apikey = 'myApiKey'
ModuleId = 1001
}
Get-EasitGODatasource @getDatasourceFromEasitGO
|
Backwards compatibility
To make the migration as easy as possible for our customers we have taken all names of functions and parameters in EasitGoWebservice and added them as aliases in Easit.GO.Webservice.
This means that when you have installed the new module in PowerShell 7.x and run this code to send items to Easit GO.
| $importEasitItem = @{
url = 'https://go.easit.com/webservice/'
api = 'myApikey'
ImportHandlerIdentifier = 'myImportHandler'
}
$adObjects = Get-ADUser -Filter * -SearchBase 'OU=RootOU,DC=company,DC=com'
foreach ($adObject in $adObjects) {
$customItem = @{prop1="$($adObject.prop1)";prop2="$($adObject.prop2)";prop3="$($adObject.prop3)"}
Import-GOCustomItem @importEasitItem -CustomProperties $customItem
}
|
You are actually running this code.
| $importEasitItem = @{
Url = 'https://go.easit.com/webservice/'
Apikey = 'myApikey'
ImportHandlerIdentifier = 'myImportHandler'
}
$adObjects = Get-ADUser -Filter * -SearchBase 'OU=RootOU,DC=company,DC=com'
foreach ($adObject in $adObjects) {
$customItem = @{prop1="$($adObject.prop1)";prop2="$($adObject.prop2)";prop3="$($adObject.prop3)"}
Send-ToEasitGO @importEasitItem -CustomItem $customItem
}
|
The same goes for getting items from Easit GO (as filtering and sorting have been completely rewritten, we do not offer backwards compatibility for that).
| $getGoItemsParams = @{
url = 'http://go.easit.com/webservice/'
api = 'myApikey'
view = 'myWebserviceView'
}
Get-GOItems @getGoItemsParams
|
You are actually running this code.
| $getGoItemsParams = @{
Url = 'http://go.easit.com/webservice/'
Apikey = 'myApikey'
ImportViewIdentifier = 'myWebserviceView'
}
Get-EasitGOItem @getGoItemsParams
|
Output / Response
As we moved to the REST based WebAPI with the module we also moved from Invoke-WebRequest to Invoke-RestMethod. This means that the response is returned as PSCustomObject out of the box and that means some changes in how you access and handle the output in your script. Below we show you an example for how this is can be done.
1
2
3
4
5
6
7
8
9
10
11
12
13 | $getEasitGOItemParams = @{
Url = 'https://go.easit.com'
Apikey = 'myApikey'
ImportViewIdentifier = 'myImportViewIdentifier'
}
$page = Get-EasitGOItem @getEasitGOItemParams
foreach ($easitObject in $page.items.item.GetEnumerator()) {
Write-Host "Got object with database id $($easitGOObject.id)"
Write-Host "The object has the following properties and values"
foreach ($propertyObject in $easitGOObject.property.GetEnumerator()) {
Write-Host "$($propertyObject.name) = $($propertyObject.content) (RawValue: $($propertyObject.rawValue))"
}
}
|
With the new parameter GetAllPages we can get all items in one go.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 | $getEasitGOItemParams = @{
Url = 'https://go.easit.com'
Apikey = 'myApikey'
ImportViewIdentifier = 'myImportViewIdentifier'
GetAllPages = $true
}
$pages = Get-EasitGOItem @getEasitGOItemParams
foreach ($page in $pages) {
foreach ($easitObject in $page.items.item.GetEnumerator()) {
Write-Host "Got object with database id $($easitGOObject.id)"
Write-Host "The object has the following properties and values"
foreach ($propertyObject in $easitGOObject.property.GetEnumerator()) {
Write-Host "$($propertyObject.name) = $($propertyObject.content) (RawValue: $($propertyObject.rawValue))"
}
}
}
|
But we can also get each item / object from all pages in a regular array.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 | $getEasitGOItemParams = @{
Url = 'https://go.easit.com'
Apikey = 'myApikey'
ImportViewIdentifier = 'myImportViewIdentifier'
GetAllPages = $true
ReturnAsSeparateObjects = $true
}
$easitObjects = Get-EasitGOItem @getEasitGOItemParams
foreach ($easitObject in $easitObjects.GetEnumerator()) {
Write-Host "Got object with database id $($easitGOObject.id)"
Write-Host "The object has the following properties and values"
foreach ($propertyObject in $easitGOObject.property.GetEnumerator()) {
Write-Host "$($propertyObject.name) = $($propertyObject.content) (RawValue: $($propertyObject.rawValue))"
}
}
|
Please let us know if you have any issues as we will be happy to help you and answer any questions you might have.