Follow along with our Postman Collection
To access the requests associated with the System endpoint, click on the OT Systems data folder in our Postman collection.
Retrieving the system repository
Returns a list with all systems in the system repository.
Request:
API Request
Python
Request:
GET ot-base/api/v1/systems
import requests
# Enter your hostname (for example: myserver.com or 127.0.0.1) between the quotes.
hostname = 'enterHostnameOrIP'
# Replace username and password with your username and password credentials.
auth=('username', 'password')
url = 'https://'+hostname+'/ot-base/api/v1/systems/'
response = requests.get(url, auth=auth)
print(response.status_code)
print(response.text)
Retrieving location data for a single system
Data for a particular system can be retrieved by addressing the system as a sub-resource of the systems resource.
Note: You can only use system IDs, but not system names.
Request:
API Request
Python
Request:
GET ot-base/api/v1/systems/systemId
import requests
# Enter your hostname (for example: myserver.com or 127.0.0.1) between the quotes.
hostname = 'enterHostnameOrIP'
# Replace username and password with your username and password credentials.
auth=('username', 'password')
# Replace enterSystemID with a system id defined in Asset Center.
systemID = 'enterSystemID'
url = 'https://'+hostname+'/ot-base/api/v1/systems/'+systemID
response = requests.get(url, auth=auth)
print(response.status_code)
print(response.text)
Updating system data, and creating a new system
Data for a particular system can be updated with a POST command.
If the system ID supplied with the command doesn't exist, a new system is created provided that a name is supplied.
API Request
Python
Request:
POST ot-base/api/v1/systems/systemId
Request Body:
data = { "name":"enterNewSystemName" }
import requests
# Enter your hostname (for example: myserver.com or 127.0.0.1) between the quotes.
hostname = 'enterHostnameOrIP'
# Replace username and password with your username and password credentials.
auth=('username', 'password')
# Replace enterSystemID with a system id defined in Asset Center.
systemID = 'enterSystemID'
url = 'https://'+hostname+'/ot-base/api/v1/systems/'+systemID
data = {
"name":"enterNewSystemName"
}
response = requests.post(url, json=data auth=auth)
print(response.status_code)
print(response.text)
Comments
0 comments
Please sign in to leave a comment.