cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
677
Views
2
Helpful
11
Replies

APIv3 does not allow grabbing list of computers?

stipend
Level 1
Level 1

Does the APIv3 not allow to grab a list of computer GUIDs in an organization? Do I have to grab the list using APIv1 or v0 and then save the GUIDs to use them in v3?

The APIv3 reference only lists connector uninstallation under the Computers section.

https://developer.cisco.com/docs/secure-endpoint/computers/

I'm trying to create a script to uninstall secure endpoint of all computers in our environment and it doesn't seem like there's a way to do it with just v3.

1 Accepted Solution

Accepted Solutions

Matthew Franks
Cisco Employee
Cisco Employee

That is correct. You would need to use the /v1/computers call and utilize that information with the v3 uninstall_request call.

Thanks,

Matt

View solution in original post

11 Replies 11

Matthew Franks
Cisco Employee
Cisco Employee

That is correct. You would need to use the /v1/computers call and utilize that information with the v3 uninstall_request call.

Thanks,

Matt

But why did they change the response format from "metadata" to "meta"!?!?!?!

Ken,

I wasn't part of the conversation for the decision, so this is speculation.
Metadata, as was used in v1, is a more encompassing term that includes data about the data such as creation date, author, etc. 
Meta, used in v3, is used for summary data such as pagination details, status codes, request IDs, etc.

When creating v3, someone made the choice to switch from the legacy metadata to meta which I realize causes more work when creating a response handler. There have been discussions around converting the v0/v1 functionality to v3 but I don't have any information on priority or timeline for that effort.

I didn't really provide much of an answer for you, but hopefully that helped in some way.

-Matt

That was me shaking my fist at the sky, knowing you'd understand the frustration behind the question... because the data in a v1 Metadata section is much the same, just organized differently...

And that we can't use the v3 bearer token to auth to v0/v1 requests is sort of bunk too... 

 

Not sure if you can assist with this or if you want me to make a separate post but I'm having troubling authenticating via APIv1. Below is my Python code. Do you know what I'm doing wrong?

I'm getting a 401 error unknown API key or Client ID. I know the API key and Client ID work since I've used them for APIv3.

api1url = 'https://api.amp.cisco.com/v1/computers'
response1 = requests.request("GET", api1url, headers={
'Content-Type': 'application/json',
'Accept-Encoding': 'gzip'},
auth=HTTPBasicAuth(client_id, client_secret), verify=False)

 

Matthew Franks
Cisco Employee
Cisco Employee

APIv1 and APIv3 have different authentication methods, so the credentials are not going to be the same. Here is a slight change to your code that works for me.

import requests
import json

CLIENT_ID = ""
API_KEY = ""
auth = (CLIENT_ID, API_KEY)

api1url = 'https://api.amp.cisco.com/v1/computers'
response1 = requests.request("GET", api1url, headers={
    'Content-Type': 'application/json',
    'Accept-Encoding': 'gzip'},
    auth=auth, verify=False)
print(response1.json())

Thanks! I had to create the credentials in another area from where I created the APIv3 credentials.

I got a powershell version together if you didn't get yours finished.

 

mine is finished, thanks.