RESTAPI and Powershell: Invoke-RestMethod not returning full xml

I want to get the deviceid with the REST API based on the device name.
I’m using powershell and the invoke-restmethod cmdlet (see script below).
But the only data that the invoke-restmethod is returning is this:

version=“1.0” encoding="UTF-8"

This is the first time I’m using the REST API and xml in powershell so I’m probably missing something obvious.

$devicename = (hostname).toLower()
$secpasswd = ConvertTo-SecureString “Password” -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential (“username”, $secpasswd)

add-type @“
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy

function get-deviceID {
param ($devname)

$url = 'https://servername:52311/api/query?relevance=(name of it, id of it, last report time of it) of bes computers whose (name of it as lowercase= ' + '"' + $devname +'")'

Invoke-RestMethod -Uri $url -Method Get -Credential $cred


get-deviceID $devicename