Powershell - Pull Requester/Technician Details through Invoke-RestMethod

Powershell - Pull Requester/Technician Details through Invoke-RestMethod

I'm trying to build a script that I can use in some automation processes and I need to pull requester and technicians details and I've tried building something with the API documentation but I'm currently getting a 3001 - Unknown error statuscode.

My Current Code:

$ciname = "Test Tech"

[xml]$input_xml = @"
<?xml version='1.0' encoding='UTF-8'?>
<API version='1.0'>
    <citype>
        <name>Technician</name>
        <criterias>
            <criteria>
                <parameter>
                    <name compOperator='CONTAINS'>CI Name</name>
                    <value>$ciname</value>
                </parameter>
            </criteria>
        </criterias>
        <returnFields>
            <name>CI Name</name>
        </returnFields>
    </citype>
</API>
"@


$techkey = "TECH___KEY___"
$ReadTechHeader = @{TECHNICIAN_KEY=$($techkey);OPERATION_NAME="read"}
$res = Invoke-RestMethod -URI $ReadTechURL -Method POST -Headers $ReadTechHeader -Body $input_xml -ContentType "application/xml"

$res.API.response.operation.result


I'll take any and all tips or suggestions here cause I'm stumped.

                New to ADManager Plus?

                  New to ADSelfService Plus?