Hardware
Getting a list of all hardwares
curl -H "X-Samanage-Authorization: Bearer TOKEN" -H 'Accept: application/vnd.samanage.v2.1+xml' -X GET
https://api.samanage.com/hardwares.xml
Getting hardware details (using hardware ID number):
curl -H "X-Samanage-Authorization: Bearer TOKEN" -H 'Accept: application/vnd.samanage.v2.1+xml' -X GET https://api.samanage.com/hardwares/HARDWARE_ID.xml
Create a new hardware:
curl -H "X-Samanage-Authorization: Bearer TOKEN" -d 'INPUT_XML' -H 'Accept: application/vnd.samanage.v2.1+xml' -H 'Content-Type:text/xml' -X POST https://api.samanage.com/hardwares.xml
Required fields:
<name>,<ssn> (= serial number)
XML Example:
<hardware>
<name>Hardware title</name>
<description>Computer_description</description>
<bio>
<manufacturer>Manufacturer_name</manufacturer>
<ssn>123456789</ssn><model>Model</model>
<version>Version_number_of_the_BIOS</version>
<bios_date>Date_of_the_BIOS</bios_date>
</bio>
<category><name>Workstation</name></category><site><name>Site_name</name></site>
<department><name>Department_name</name></department>
<ip>10.0.0.0</ip>
<external_ip>000.000.000.000</external_ip><status><name>Operational</name></status>
<tag>Tag</tag>
<asset_tag>Asset_Tag_ID</asset_tag>
<technical_contact><email>demo@samanage.com</email></technical_contact><owner><email>demo@samanage.com</email></owner>
<notes>Resource_Details_Notes</notes>
<barcode_encoding_format>Code128A</barcode_encoding_format>
<cpu>Computer_CPU</cpu>
<processor_speed>Speed_of_the_CPU</processor_speed>
<memory>1024</memory>
<swap>MB</swap>
<operating_system>Machine_Operating_System</operating_system>
<domain>Computer_Domain</domain>
<active_directory>Workgroup_of_the_OS</active_directory>
<address>Building/Floor/Room</address>
<longitude>00.000</longitude>
<latitude>00.0000</latitude><product_number>ABCD123</product_number>
<custom_fields_values>
<custom_fields_value>
<name>field_name</name>
<value>content</value>
</custom_fields_value>
<custom_fields_value>
<name>field_name</name>
<value>content</value>
</custom_fields_value>
</custom_fields_values>
</hardware>
JSON Example:
{
"hardware":{
"name":"hardware_title",
"description":"Computer_description","bio":{"manufacturer":"manufacturer_name","ssn":"123456789","model":"model","version":"Version_number_of_the_BIOS","bios_date":"Date_of_the_BIOS"},
"category":{"name":"workstation"},
"site":{"name":"site_name"},
"department":{"name":"department_name"},
"Ip_address":"10.0.0.0",
"external_ip":"000.000.000.000",
"status":{"name":"Operational"},
"Tag":"tag",
"asset_tag":"Asset_Tag_ID","technical_contact":{"email":"demo@samanage.com"},
"owner":{"email":"demo@samanage.com"},
"notes":"Resource_Details_Notes","barcode_encoding_format":"Code128A",
"cpu":"Computer_CPU",
"processor_speed":"Speed_of_the_CPU",
"memory":1024,
"swap":"MB",
"operating_system":"Machine_Operating_System",
"domain":"Computer_Domain",
"active_directory":"Workgroup_of_the_OS",
"address":"Building/Floor/Room",
"longitude":"00.000",
"latitude":"00.000","product_number":"ABCD123",
"custom_fields_values":{
"custom_fields_value":[
{"name":"field_name","value":"content"},
{"name":"field_name","value":"content"}]
}
}
}
Updating an existing hardware:
curl -H "X-Samanage-Authorization: Bearer TOKEN" -d 'INPUT_XML' -H 'Accept: application/xml' -H 'Content-Type:text/xml' -X PUT https://api.samanage.com/hardwares/HARDWARE_ID.xml
XML Example:
<hardware>
<field_to_update>content</field_to_update>
</hardware>
JSON Example:
{
"hardware":{
"field_to_update":"content",
}
}
Deleting a hardware:
curl -H "X-Samanage-Authorization: Bearer TOKEN" -H 'Accept: application/vnd.samanage.v2.1+xml' -X DELETE https://api.samanage.com/hardwares/HARDWARE_ID.xml