Invoke-RestMethod, output too long

Hi, I have a bit of a prolem with an API. The API runs and returns partial informations, the output is like cropped.

Here is my code

$Path = "C:\Temp\Details.txt"
$response = Invoke-RestMethod -Uri $url -Method Get -WebSession $session -ContentType "application/json"
$response | Out-File -FilePath $Path -Append 

The $url and $session are correctly declared above. I tried both outputtin all to a file and using Write-Output, but the result is the same.

Here is my output:

MediaInfoWebApiDetails

@{MediaSerialNumber=2088106169; MediaUnicityId=2; IsBlackListed=; IsLocked=; IsInvalid=False; IsExpired=; IsFull=False; IsSalesUnavailable=; ExpirationDate=2029-08-31T00:00:00; HolderBirthDate=; Contra…

As you can see it isn’t fully displayed, a big chunk is missing, any idea on how to fix this? I also tried to put | Out-File without using a variable, but got the same result.

Thank you in advance

Solved, didn’t know there was the outfile method

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.