Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: SaaS Bulk Seat Update Endpoint should be SET with PUT call. #2

Closed
1 task done
cksapp opened this issue Jan 7, 2024 · 3 comments · Fixed by #3
Closed
1 task done

[Bug]: SaaS Bulk Seat Update Endpoint should be SET with PUT call. #2

cksapp opened this issue Jan 7, 2024 · 3 comments · Fixed by #3
Assignees

Comments

@cksapp
Copy link
Contributor

cksapp commented Jan 7, 2024

What happened?

SaaS Bulk Seat Assignment endpoint is actually an HTTP PUT call, and so the current implementation with the Get-DattoBulkSeatAssignment function does not work as expected.

Get-DattoBulkSeatAssignment

cmdlet Get-DattoBulkSeatAssignment at command pipeline position 1
Supply values for the following parameters:
saasCustomerId: 123456
externalSubscriptionId: Classic:Office365:123456
WARNING: The [ Datto_invokeParameters, Datto_queryString, & Datto_CmdletNameParameters ] variables can provide extra details
Invoke-DattoRequest : Invoke-DattoRequest : [ /saas/123456/Classic:Office365:123465/bulkSeatAssignment ] not found!
At C:\Users\first.last\OneDrive\Documents\WindowsPowerShell\Modules\DattoAPI\2.2.1\DattoAPI.psm1:2385 char:9
+         Invoke-DattoRequest -method GET -resource_Uri $resource_Uri - ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-DattoRequest

Expected behavior?

Seat change in the UI as expected for the SaaS Protection Organization seat,

Example response received for valid response body received from bulk seat change endpoint.
2024-01-07_370

Possible Solution?

Should be able to have this work with the proper PUT, working on a fork to merge into the dev branch. This would be my first merge to another public repo and contributing, so any feedback is well appreciated.

Trying to get the conversation started on everything expected here for the module, and what may be needed for the proper implementation.

PowerShell Version

5.1 - (PowerShell)

What operating system are you seeing the problem on?

Windows

Relevant log output

Get-DattoBulkSeatAssignment

cmdlet Get-DattoBulkSeatAssignment at command pipeline position 1
Supply values for the following parameters:
saasCustomerId: 123456
externalSubscriptionId: Classic:Office365:123456
WARNING: The [ Datto_invokeParameters, Datto_queryString, & Datto_CmdletNameParameters ] variables can provide extra details
Invoke-DattoRequest : Invoke-DattoRequest : [ /saas/123456/Classic:Office365:123465/bulkSeatAssignment ] not found!
At C:\Users\first.last\OneDrive\Documents\WindowsPowerShell\Modules\DattoAPI\2.2.1\DattoAPI.psm1:2385 char:9
+         Invoke-DattoRequest -method GET -resource_Uri $resource_Uri - ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-DattoRequest

Help Commands

$PSversionTable

$PSversionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      19041  3803


Get-Package -Name xxxModuleNamexxx | Select-Object Name,Version,Source,ProviderName
```PowerShell
Get-Package DattoApi | Select-Object Name,Version,Source,ProviderName

Name     Version Source                                   ProviderName
----     ------- ------                                   ------------
DattoAPI 2.2.1   https://www.powershellgallery.com/api/v2 PowerShellGet

Get-ComputerInfo -Property @( 'OsName', 'OsVersion', 'OsOperatingSystemSKU', 'OSArchitecture', 'WindowsVersion', 'WindowsBuildLabEx', 'OsLanguage', 'OsMuiLanguages' )

OsName               : Microsoft Windows 10 Enterprise
OsVersion            : 10.0.19045
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

Code of Conduct

  • I agree to follow this project's Code of Conduct
@cksapp
Copy link
Contributor Author

cksapp commented Jan 8, 2024

So far, in 57b44dc, I have been able to get the SaaS bulk seat change endpoint to accept the PUT request.
This returns a response from the server similarly as seen prior, but for some reason the changes do not appear to be effective and do not actually make the seat change.

Set-DattoBulkSeatAssignment -saasCustomerId "123456" -externalSubscriptionId "Classic:Office365:123456" -seatType "SharedMailbox" -remoteId "ab23-bdf234-1234-asdf" -actionType "License" -Verbose
VERBOSE: Running the [ index ] parameterSet
VERBOSE: PUT https://api.datto.com/v1/saas/123456/Classic:Office365:123456/bulkSeatChange with -1-byte payload
VERBOSE: received -1-byte response of content type application/json
{"action":"BulkSeatChange","appType":"Global","customerId":123456,"id":1704754852491,"status":"started"}

This was fixed in e0a6f62 and appears to accept the PUT request , this was validated that the endpoint made the changes in the UI.

@Celerium
Copy link
Owner

Hi @cksapp, thanks for bring this to my attention! I honestly dont remember there ever being a PUT endpoint in their API when i wrote this, but it is for sure there now.

I will take a closer look at this, this weekend when I have some spare time.

Also I have been meaning to delete the dev branch of this repo for a while, so whenever you have a moment go ahead and make a pull request to the main branch. I will be deleting the dev branch in the near future.

@cksapp
Copy link
Contributor Author

cksapp commented Jan 16, 2024

thanks for bring this to my attention! I honestly dont remember there ever being a PUT endpoint in their API when i wrote this, but it is for sure there now.

The Put was new to support the SaaS bulk seat changes as far as I understand, and honestly fairly exciting imo. Here's to hoping we can get some more functionality with added integrations as currently this is the only call that makes use of the PUT method. 🤞

Also I have been meaning to delete the dev branch of this repo for a while, so whenever you have a moment go ahead and make a pull request to the main branch. I will be deleting the dev branch in the near future.

Can do here, one thing as I was drafting this when you commented here 😅. Not sure what I did incorrectly here, as it seems that none of the build tests from the PR ran successfully.

Feel free to check back when you can to review this. No rush, and all feedback is much appreciated here too. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants