Hi,
I did follow the manual with cURL but i couldnt connect to sophos, i try with ps and worked but it didnt bring me any endpoint, could you point me in the right direction.
Thanks
Hi,
I did follow the manual with cURL but i couldnt connect to sophos, i try with ps and worked but it didnt bring me any endpoint, could you point me in the right direction.
Thanks
Hi Jhon,
Let me know what your PowerShell looks like, I was able to get a list of devices returned by running the following.
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("X-Tenant-ID", "<Tenant-ID>")
$headers.Add("Authorization", "Bearer <Token>")
$response = Invoke-RestMethod 'https://api-<Region>.central.sophos.com/endpoint/v1/endpoints' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
Hi Jhon,
Let me know what your PowerShell looks like, I was able to get a list of devices returned by running the following.
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("X-Tenant-ID", "<Tenant-ID>")
$headers.Add("Authorization", "Bearer <Token>")
$response = Invoke-RestMethod 'https://api-<Region>.central.sophos.com/endpoint/v1/endpoints' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
Hi Qoosh,
Thanks for your reply, the message that I get is: Invoke-RestMethod : {"message":"Forbidden"}, in both cases idk if im right because im in direct tenant im not a partner, i did create api credential
If the API Credential was created within the Tenant, this should allow you to query the devices that are registered. I am testing in a similar fashion, however, from an Enterprise Dashboard deployment.
Do you know if your API Credential was created with the role "Service Principal Super Admin"?
no, i created with the role Service Principal Management, it required to be super admin to get the endpoints, i can create a new role and test
I tested using "Service Principal Management" and the query worked for me, though the "Forbidden" error leads me to believe this could be permission-related.
Let me know if the Super Admin permission allows the query to go through.
i created a service super admin, and tested same result, but i tested two uri
$response = Invoke-RestMethod 'api5.central.sophos.com/gateway' -Method GET -Headers $headers
$response | ConvertTo-Json
[
[
[
],
[
"System.Xml.XmlWhitespace",
"System.Xml.XmlElement",
"System.Xml.XmlWhitespace"
this return with no error, but nothing useful
but api5.central.sophos.com/.../endpoints return forbidden
last reply was set as abuse, in resume i tested two uri
this return no error but nothing useful
'api5.central.sophos.com/gateway'
This return error forbidden
sorry, i did start all over again, and now works with your script.
thanks