AndrewPla / TOPdeskPS

PowerShell module to interact with the TOPdesk API
MIT License
30 stars 12 forks source link

Disconnect-TdService #102

Open mabster opened 4 years ago

mabster commented 4 years ago

Prerequisites

Put an X between the brackets on each line to confirm you have completed them:

Describe the bug Disconnect-TdService throws an exception.

To Reproduce Connect to TOPdesk with a valid operator and application password. Call Disconnect-TdService.

Expected behavior The command executes without error.

Screenshots or Transcripts

Disconnect-TdService

Invoke-RestMethod : Object reference not set to an instance of an object. At C:\Program Files\WindowsPowerShell\Modules\TOPdeskPS\0.1.5\TOPdeskPS.psm1:2861 char:19

Additional context Maybe we don't need to disconnect. Feel free to let me know and just go ahead and close this issue if that's the case. :)

AndrewPla commented 4 years ago

Thanks for creating an issue for this. I will be looking at these this week and hopefully pushing out a new update to the module shortly after that.

On Mon, Jul 27, 2020 at 1:33 AM Matt Hamilton notifications@github.com wrote:

Prerequisites

Put an X between the brackets on each line to confirm you have completed them:

  • The issue is still present in the latest version of the module.
  • The issue has not been previously reported.

Describe the bug Disconnect-TdService throws an exception.

To Reproduce Connect to TOPdesk with a valid operator and application password. Call Disconnect-TdService.

Expected behavior The command executes without error.

Screenshots or Transcripts

Disconnect-TdService

Invoke-RestMethod : Object reference not set to an instance of an object. At C:\Program Files\WindowsPowerShell\Modules\TOPdeskPS\0.1.5\TOPdeskPS.psm1:2861 char:19

-

   $result = Invoke-RestMethod @parameter -ErrorAction Stop

-

             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : NotSpecified: (:) [Invoke-RestMethod], NullReferenceException
    • FullyQualifiedErrorId : System.NullReferenceException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

Additional context Maybe we don't need to disconnect. Feel free to let me know and just go ahead and close this issue if that's the case. :)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/AndrewPla/TOPdeskPS/issues/102, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHW57ACJXU6AUAXJIBDZE53R5UGSVANCNFSM4PIMOJ5A .

mabster commented 4 years ago

No, thank YOU for the module! Already doing cool things with the TOPdesk API thanks to your work!

mabster commented 4 years ago

Some more info on this. Turns out the NullReferenceException only happens if you try to call Disconnect-TdService again after it has errored the first time. The initial error I'm getting is:

Invoke-RestMethod : The remote server returned an error: (401) Unauthorized. At C:\Program Files\WindowsPowerShell\Modules\TOPdeskPS\0.1.5\TOPdeskPS.psm1:2864 char:19

So it's like I don't have access to the "logout" endpoint, which is weird because I'm definitely connected to our TOPdesk instance.