getManagedEndpointDetails

I am trying to use the Control Center API to get the details about an endpoint from GravityZone. I've got all the basics working. I generated the API key and I am able to authenticate and query data. Now I am trying to use the code at the bottom of this message to get the details about an endpoint. (For brevity, I left out the code that uses the API Key to generate the Auth header ($auth_header), but I know that's working since I'm able to get results from my queries.) In the example below, I substituted the Id that is returned from getNetworkInventoryItems into $endpointId.

$request_uri = "https://cloud.gravityzone.bitdefender.com/api/v1.0/jsonrpc/network"

$gMED= '{

  "params": {

   "endpointId": "'aabbccddeeff11223344'"

  },

  "jsonrpc": "2.0",

  "method": "getManagedEndpointDetails",

  "id": "301f7b05-ec02-481b-9ed6-c07b97de2b7b"

 }'


$params = @{

  Uri   = $request_uri

  Headers  = @{

   'Authorization' = "$authheader"

   'Content-Type' = "application/json"

  }

  Method  = 'POST'

  Body  = $gMED

  ContentType = 'application/json'

 }

$response = Invoke-RestMethod @params

No matter what I use for the endpointId, $response.error.data always contains "Syntax error, malformed JSON." I copied the JSON parameters straight from the documentation and it looks correct, but maybe I am overlooking something. I have code for endpoints like getNetworkInventoryItems working great, but not this one.

Can you help me figure this out?

Answers