I want to automate the updating of our chromebook assets that are in WHD. I was looking at the API documentation and I believe it looks like the API could be used.
I can see how to do this manually with the template download and going through the application front end. When we do this through the application we only use a few of these fields on the template to update the data - basically trying to update the Status of the item as they get checked in/out, sent out for repairs, retired, etc. To do this via the application the sheet basically looks like below and the remaining fields are empty.
Asset No. | Asset Type | Manufacturer | Model | Version | Status | Serial Number | IP Address | Network Name | MAC Address | Location |
111 | Chromebook | Lenovo | Lenovo N22 Chromebook | | Retired | abc123 | | | | Retired |
222 | Chromebook | Lenovo | Lenovo N22 Chromebook | | Checked Out | efg345 | | | | High School |
333 | Chromebook | Lenovo | Lenovo 100e Chromebook | | Available | hjk789 | | | | Middle School |
I’m kinda new to APIs, and learning how to read API documentation. I figured out how to do a GET of an individual asset in JSON format, so this allowed me to “test” my connection (I'm connecting to the WHD API via a Google Apps script). Our database is SQL 2014, so no JSON, so I’m trying to figure out from the WHD API documentation what exact fields I need to populate in the XML as what the API shows have way more fields for assets then the WHD template. I read the API documentation section about updating an asset is basically the same as creating an asset and it had a sample JSON file that I converted to XML (to explain where the below XML bit came from) and added the bits from above. Is this all I need? (I looked the status “5” up in the backend WHD Asset_status table to get the corresponding number for “retired”) - I hardcoded the “<type> fields like “Asset”:
<row>
<id></id>
<type>Asset</type>
<assetNumber>111</assetNumber>
<contractExpiration />
<macAddress />
<networkAddress />
<networkName />
<purchaseDate />
<serialNumber>abc123</serialNumber>
<version />
<assetstatus>
<id>5</id>
<type>AssetStatus</type>
</assetstatus>
<billingRate />
<location>
<id></id>
<type>Location</type>
<address />
<city />
<locationName>Retired</locationName>
<postalCode />
<state />
<defaultPriorityTypeId />
</location>
<model>
<id></id>
<type>Model</type>
<assetTypeId></assetTypeId>
<manufacturerId></manufacturerId>
<modelId></modelId>
<modelName>Lenovo N22 Chromebook</modelName>
<warrantyTypeId />
<assettype>
<id></id>
<type>AssetType</type>
<assetType>Chromebook</assetType>
</assettype>
<manufacturer>
<id></id>
<type>Manufacturer</type>
<address />
<city />
<country />
<fax />
<fullName></fullName>
<manufacturerid></manufacturerid>
<name>Lenovo</name>
<phone />
<postalCode />
<state />
<url />
</manufacturer>
</model>
<room />
<warrantyType />
<clients />
<isSynchronizationDisabled />
<isReservable />
<leaseExpirationDate />
<warrantyExpirationDate />
<isNotesVisibleToClients />
<isDeleted />
</row>
Thanks for your guidance/suggestions. I hope I have provided enough detail to understand what I am trying to understand.