Files
powershell-scripts/docs/ShopDB-API.html
cproudlock 7d3519f613 Add comprehensive documentation and update deployment paths
Documentation:
- Add ShopDB-API.md with full API reference (all GET/POST endpoints)
- Add detailed docs for Update-ShopfloorPCs-Remote, Invoke-RemoteMaintenance, Update-PC-CompleteAsset
- Add DATA_COLLECTION_PARITY.md comparing local vs remote data collection
- Add HTML versions of all documentation with styled code blocks
- Document software deployment mechanism and how to add new apps
- Document deprecated scripts (Invoke-RemoteAssetCollection, Install-KioskApp)

Script Updates:
- Update deployment source paths to network share (tsgwp00525.wjs.geaerospace.net)
  - InstallDashboard: \\...\scripts\Dashboard\GEAerospaceDashboardSetup.exe
  - InstallLobbyDisplay: \\...\scripts\LobbyDisplay\GEAerospaceLobbyDisplaySetup.exe
  - UpdateEMxAuthToken: \\...\scripts\eMx\eMxInfo.txt
  - DeployUDCWebServerConfig: \\...\scripts\UDC\udc_webserver_settings.json
- Update machine network detection to include 100.0.0.* for CMM cases
- Rename PC Type #9 from "Part Marker" to "Inspection"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 11:45:00 -05:00

876 lines
24 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ShopDB API Reference</title>
<style>
* {
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 1.6;
max-width: 900px;
margin: 0 auto;
padding: 20px 40px;
background-color: #ffffff;
color: #333;
}
h1 {
color: #1a5276;
border-bottom: 3px solid #1a5276;
padding-bottom: 10px;
margin-top: 0;
}
h2 {
color: #2874a6;
border-bottom: 2px solid #d5dbdb;
padding-bottom: 8px;
margin-top: 40px;
}
h3 {
color: #2e86ab;
margin-top: 30px;
}
h4 {
color: #5d6d7e;
margin-top: 25px;
}
a {
color: #2980b9;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
code {
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
background-color: #f4f4f4;
padding: 2px 6px;
border-radius: 3px;
font-size: 0.9em;
border: 1px solid #e1e1e1;
}
pre {
background-color: #2d2d2d;
color: #f8f8f2;
padding: 15px 20px;
border-radius: 6px;
overflow-x: auto;
font-family: 'Cascadia Mono', 'JetBrains Mono', 'Fira Code', 'Source Code Pro', 'DejaVu Sans Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
font-size: 14px;
line-height: 1.4;
border: 1px solid #444;
margin: 15px 0;
-webkit-font-feature-settings: "liga" 0;
font-feature-settings: "liga" 0;
letter-spacing: 0;
}
pre code {
background-color: transparent;
padding: 0;
border: none;
color: inherit;
font-size: inherit;
}
table {
border-collapse: collapse;
width: 100%;
margin: 15px 0;
font-size: 14px;
}
th, td {
border: 1px solid #ddd;
padding: 10px 12px;
text-align: left;
}
th {
background-color: #34495e;
color: white;
font-weight: 600;
}
tr:nth-child(even) {
background-color: #f9f9f9;
}
tr:hover {
background-color: #f1f1f1;
}
ul, ol {
padding-left: 25px;
}
li {
margin-bottom: 5px;
}
blockquote {
border-left: 4px solid #3498db;
margin: 15px 0;
padding: 10px 20px;
background-color: #f8f9fa;
color: #555;
}
hr {
border: none;
border-top: 2px solid #eee;
margin: 30px 0;
}
.toc {
background-color: #f8f9fa;
border: 1px solid #e9ecef;
border-radius: 6px;
padding: 20px;
margin-bottom: 30px;
}
.toc h2 {
margin-top: 0;
border-bottom: none;
font-size: 1.2em;
}
.toc ul {
list-style-type: none;
padding-left: 0;
}
.toc li {
margin-bottom: 8px;
}
.toc a {
color: #2c3e50;
}
.note {
background-color: #fff3cd;
border-left: 4px solid #ffc107;
padding: 10px 15px;
margin: 15px 0;
}
.warning {
background-color: #f8d7da;
border-left: 4px solid #dc3545;
padding: 10px 15px;
margin: 15px 0;
}
@media print {
body {
max-width: 100%;
padding: 20px;
}
pre {
white-space: pre-wrap;
word-wrap: break-word;
}
h2 {
page-break-before: auto;
}
pre, table {
page-break-inside: avoid;
}
}
</style>
</head>
<body>
<h1 id="shopdb-api-reference">ShopDB API Reference</h1>
<p>REST API for PowerShell data collection scripts and ShopDB integrations.</p>
<h2 id="table-of-contents">Table of Contents</h2>
<ul>
<li><a href="#overview">Overview</a></li>
<li><a href="#base-url">Base URL</a></li>
<li><a href="#authentication">Authentication</a></li>
<li><a href="#endpoints">Endpoints</a></li>
<li><a href="#get-endpoints">GET Endpoints</a></li>
<li><a href="#post-endpoints">POST Endpoints</a></li>
<li><a href="#response-format">Response Format</a></li>
<li><a href="#error-handling">Error Handling</a></li>
<li><a href="#powershell-integration">PowerShell Integration</a></li>
</ul>
<hr>
<h2 id="overview">Overview</h2>
<p>The ShopDB API (<code>api.asp</code>) provides endpoints for:</p>
<ul>
<li><strong>Data Collection</strong>: Receive PC asset data from PowerShell scripts</li>
<li><strong>PC Retrieval</strong>: Query lists of shopfloor PCs for remote management</li>
<li><strong>Maintenance</strong>: Update WinRM status, printer mappings, installed applications</li>
<li><strong>Dashboard</strong>: Health checks and monitoring data</li>
</ul>
<p><strong>Technology</strong>: Classic ASP (VBScript) with MySQL database</p>
<hr>
<h2 id="base-url">Base URL</h2>
<table>
<thead><tr>
<th>Environment</th>
<th>URL</th>
</tr></thead>
<tbody>
<tr>
<td>Production</td>
<td><code>https://tsgwp00525.rd.ds.ge.com/shopdb/api.asp</code></td>
</tr>
<tr>
<td>Development</td>
<td><code>http://192.168.122.151:8080/api.asp</code></td>
</tr>
</tbody></table>
<hr>
<h2 id="authentication">Authentication</h2>
<p>Currently no authentication required. API is accessible from internal network only.</p>
<hr>
<h2 id="endpoints">Endpoints</h2>
<h3 id="get-endpoints">GET Endpoints</h3>
<h4 id="getdashboarddata">getDashboardData</h4>
<p>Health check endpoint to verify API is online.</p>
<p><strong>Request:</strong></p>
<pre><code>GET /api.asp?action=getDashboardData</code></pre>
<p><strong>Response:</strong></p>
<pre><code class="language-json">{
&quot;success&quot;: true,
&quot;message&quot;: &quot;ShopDB API is online - v13 (inlined all queries)&quot;,
&quot;version&quot;: &quot;1.0&quot;,
&quot;schema&quot;: &quot;Phase 2&quot;,
&quot;connStatus&quot;: &quot;objConn is Open&quot;
}</code></pre>
<p><strong>Used By:</strong> Health monitoring, connectivity tests</p>
<hr>
<h4 id="getshopfloorpcs">getShopfloorPCs</h4>
<p>Returns list of all active shopfloor PCs for remote management operations.</p>
<p><strong>Request:</strong></p>
<pre><code>GET /api.asp?action=getShopfloorPCs
GET /api.asp?action=getShopfloorPCs&amp;pctypeid=1
GET /api.asp?action=getShopfloorPCs&amp;businessunitid=2</code></pre>
<p><strong>Query Parameters:</strong></p>
<table>
<thead><tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr></thead>
<tbody>
<tr>
<td><code>pctypeid</code></td>
<td>int</td>
<td>Filter by PC type (optional)</td>
</tr>
<tr>
<td><code>businessunitid</code></td>
<td>int</td>
<td>Filter by business unit (optional)</td>
</tr>
</tbody></table>
<p><strong>PC Type IDs:</strong></p>
<table>
<thead><tr>
<th>ID</th>
<th>Type</th>
</tr></thead>
<tbody>
<tr>
<td>1</td>
<td>Shopfloor</td>
</tr>
<tr>
<td>2</td>
<td>CMM</td>
</tr>
<tr>
<td>3</td>
<td>Wax Trace</td>
</tr>
<tr>
<td>4</td>
<td>Keyence</td>
</tr>
<tr>
<td>5</td>
<td>EAS1000</td>
</tr>
<tr>
<td>6</td>
<td>Genspect</td>
</tr>
<tr>
<td>7</td>
<td>Heat Treat</td>
</tr>
<tr>
<td>8</td>
<td>Engineer</td>
</tr>
<tr>
<td>9</td>
<td>Standard</td>
</tr>
<tr>
<td>10</td>
<td>Inspection</td>
</tr>
<tr>
<td>11</td>
<td>Dashboard</td>
</tr>
<tr>
<td>12</td>
<td>Lobby Display</td>
</tr>
</tbody></table>
<p><strong>Response:</strong></p>
<pre><code class="language-json">{
&quot;success&quot;: true,
&quot;count&quot;: 45,
&quot;data&quot;: [
{
&quot;machineid&quot;: 1234,
&quot;hostname&quot;: &quot;G1ZTNCX3ESF&quot;,
&quot;machinenumber&quot;: &quot;M0612, M0613&quot;,
&quot;serialnumber&quot;: &quot;ABC1234567&quot;,
&quot;ipaddress&quot;: &quot;10.134.50.101&quot;,
&quot;loggedinuser&quot;: &quot;DOMAIN\\jsmith&quot;,
&quot;pctype&quot;: &quot;Shopfloor&quot;,
&quot;pctypeid&quot;: 1,
&quot;businessunit&quot;: &quot;Rotor&quot;,
&quot;businessunitid&quot;: 2,
&quot;lastupdated&quot;: &quot;1/15/2025 8:30 AM&quot;
}
]
}</code></pre>
<p><strong>Notes:</strong></p>
<ul>
<li>Returns only PCs with 10.134.<em>.</em> IP addresses by default</li>
<li>Dashboard (11) and Lobby Display (12) types bypass IP filter</li>
<li>Only includes machinetypeid 33-35 (actual PCs)</li>
</ul>
<p><strong>Used By:</strong> <code>Update-ShopfloorPCs-Remote.ps1 -All</code>, <code>Invoke-RemoteMaintenance.ps1 -All</code></p>
<hr>
<h4 id="gethighuptimepcs">getHighUptimePCs</h4>
<p>Returns PCs that haven't been rebooted in specified number of days.</p>
<p><strong>Request:</strong></p>
<pre><code>GET /api.asp?action=getHighUptimePCs&amp;minUptime=30</code></pre>
<p><strong>Query Parameters:</strong></p>
<table>
<thead><tr>
<th>Parameter</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr></thead>
<tbody>
<tr>
<td><code>minUptime</code></td>
<td>int</td>
<td>10</td>
<td>Minimum uptime in days</td>
</tr>
</tbody></table>
<p><strong>Response:</strong></p>
<pre><code class="language-json">{
&quot;success&quot;: true,
&quot;count&quot;: 5,
&quot;minUptime&quot;: 30,
&quot;data&quot;: [
{
&quot;machineid&quot;: 1234,
&quot;hostname&quot;: &quot;SHOPFLOOR-01&quot;,
&quot;machinenumber&quot;: &quot;M0612&quot;,
&quot;serialnumber&quot;: &quot;ABC1234567&quot;,
&quot;ipaddress&quot;: &quot;10.134.50.101&quot;,
&quot;loggedinuser&quot;: &quot;DOMAIN\\jsmith&quot;,
&quot;pctype&quot;: &quot;Shopfloor&quot;,
&quot;uptime_days&quot;: 45,
&quot;lastboottime&quot;: &quot;2024-12-01 08:00:00&quot;,
&quot;pctypeid&quot;: 1,
&quot;businessunit&quot;: &quot;Rotor&quot;,
&quot;businessunitid&quot;: 2,
&quot;lastupdated&quot;: &quot;1/15/2025 8:30 AM&quot;
}
]
}</code></pre>
<p><strong>Used By:</strong> <code>Update-ShopfloorPCs-Remote.ps1 -Reboot -MinUptimeDays 30</code></p>
<hr>
<h4 id="getrecordedip">getRecordedIP</h4>
<p>Get the recorded IP address for a specific hostname.</p>
<p><strong>Request:</strong></p>
<pre><code>GET /api.asp?action=getRecordedIP&amp;hostname=G1ZTNCX3ESF</code></pre>
<p><strong>Query Parameters:</strong></p>
<table>
<thead><tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr></thead>
<tbody>
<tr>
<td><code>hostname</code></td>
<td>string</td>
<td>Computer name to look up</td>
</tr>
</tbody></table>
<p><strong>Response:</strong></p>
<pre><code class="language-json">{
&quot;success&quot;: true,
&quot;hostname&quot;: &quot;G1ZTNCX3ESF&quot;,
&quot;ipaddress&quot;: &quot;10.134.50.101&quot;
}</code></pre>
<hr>
<h4 id="getpcmachinerelationships">getPCMachineRelationships</h4>
<p>Returns PCs that have relationships to equipment (machines).</p>
<p><strong>Request:</strong></p>
<pre><code>GET /api.asp?action=getPCMachineRelationships</code></pre>
<p><strong>Response:</strong></p>
<pre><code class="language-json">{
&quot;success&quot;: true,
&quot;count&quot;: 25,
&quot;data&quot;: [
{
&quot;pc_machineid&quot;: 1234,
&quot;pc_hostname&quot;: &quot;G1ZTNCX3ESF&quot;,
&quot;equipment_machineid&quot;: 5678,
&quot;equipment_machinenumber&quot;: &quot;M0612&quot;
}
]
}</code></pre>
<hr>
<h3 id="post-endpoints">POST Endpoints</h3>
<h4 id="updatecompleteasset">updateCompleteAsset</h4>
<p>Main endpoint for PC data collection. Receives comprehensive asset data from PowerShell scripts.</p>
<p><strong>Request:</strong></p>
<pre><code>POST /api.asp
Content-Type: application/x-www-form-urlencoded
action=updateCompleteAsset
&amp;hostname=G1ZTNCX3ESF
&amp;serialNumber=ABC1234567
&amp;manufacturer=Dell Inc.
&amp;model=OptiPlex 7080
&amp;pcType=Shopfloor
&amp;loggedInUser=DOMAIN\jsmith
&amp;machineNo=M0612
&amp;osVersion=Microsoft Windows 10 Enterprise
&amp;lastBootTime=2025-01-15 08:30:00
&amp;hasVnc=1
&amp;hasWinRM=1
&amp;networkInterfaces=[...]
&amp;dncConfig=[...]
&amp;installedApps=[...]</code></pre>
<p><strong>Required Parameters:</strong></p>
<table>
<thead><tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr></thead>
<tbody>
<tr>
<td><code>hostname</code></td>
<td>string</td>
<td>Computer name</td>
</tr>
<tr>
<td><code>serialNumber</code></td>
<td>string</td>
<td>BIOS serial number</td>
</tr>
</tbody></table>
<p><strong>Optional Parameters:</strong></p>
<table>
<thead><tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr></thead>
<tbody>
<tr>
<td><code>manufacturer</code></td>
<td>string</td>
<td>System manufacturer</td>
</tr>
<tr>
<td><code>model</code></td>
<td>string</td>
<td>System model</td>
</tr>
<tr>
<td><code>pcType</code></td>
<td>string</td>
<td>PC classification (Shopfloor, CMM, etc.)</td>
</tr>
<tr>
<td><code>loggedInUser</code></td>
<td>string</td>
<td>Currently logged in user</td>
</tr>
<tr>
<td><code>machineNo</code></td>
<td>string</td>
<td>Associated machine number(s)</td>
</tr>
<tr>
<td><code>osVersion</code></td>
<td>string</td>
<td>Windows version</td>
</tr>
<tr>
<td><code>lastBootTime</code></td>
<td>datetime</td>
<td>Last boot timestamp</td>
</tr>
<tr>
<td><code>hasVnc</code></td>
<td>int</td>
<td>VNC installed (0/1)</td>
</tr>
<tr>
<td><code>hasWinRM</code></td>
<td>int</td>
<td>WinRM enabled (0/1)</td>
</tr>
<tr>
<td><code>networkInterfaces</code></td>
<td>JSON</td>
<td>Network adapter configurations</td>
</tr>
<tr>
<td><code>dncConfig</code></td>
<td>JSON</td>
<td>DNC/FTP settings</td>
</tr>
<tr>
<td><code>installedApps</code></td>
<td>JSON</td>
<td>Tracked applications</td>
</tr>
<tr>
<td><code>warrantyEndDate</code></td>
<td>date</td>
<td>Dell warranty expiration</td>
</tr>
<tr>
<td><code>warrantyStatus</code></td>
<td>string</td>
<td>Warranty status text</td>
</tr>
<tr>
<td><code>dncDualPathEnabled</code></td>
<td>int</td>
<td>Dual path enabled (0/1)</td>
</tr>
<tr>
<td><code>dncPath1Name</code></td>
<td>string</td>
<td>Path 1 name</td>
</tr>
<tr>
<td><code>dncPath2Name</code></td>
<td>string</td>
<td>Path 2 name</td>
</tr>
</tbody></table>
<p><strong>Network Interfaces JSON Format:</strong></p>
<pre><code class="language-json">[
{
&quot;interfaceName&quot;: &quot;Ethernet0&quot;,
&quot;ipAddress&quot;: &quot;10.134.50.101&quot;,
&quot;subnetMask&quot;: &quot;24&quot;,
&quot;defaultGateway&quot;: &quot;10.134.50.1&quot;,
&quot;macAddress&quot;: &quot;00-11-22-33-44-55&quot;,
&quot;isDhcp&quot;: 0,
&quot;isActive&quot;: 1,
&quot;isMachineNetwork&quot;: 0,
&quot;isPrimary&quot;: 1
}
]</code></pre>
<p><strong>DNC Config JSON Format:</strong></p>
<pre><code class="language-json">{
&quot;site&quot;: &quot;WJF&quot;,
&quot;cnc&quot;: &quot;FANUC&quot;,
&quot;ncif&quot;: &quot;FOCAS2&quot;,
&quot;machineNo&quot;: &quot;M0612&quot;,
&quot;ftpPrimary&quot;: &quot;10.134.50.10&quot;,
&quot;ftpSecondary&quot;: &quot;10.134.50.11&quot;
}</code></pre>
<p><strong>Installed Apps JSON Format:</strong></p>
<pre><code class="language-json">[
{
&quot;appid&quot;: 5,
&quot;appname&quot;: &quot;PC-DMIS&quot;,
&quot;version&quot;: &quot;2023.1&quot;,
&quot;isactive&quot;: 1
}
]</code></pre>
<p><strong>Response:</strong></p>
<pre><code class="language-json">{
&quot;success&quot;: true,
&quot;message&quot;: &quot;PC data stored successfully&quot;,
&quot;pcid&quot;: 1234,
&quot;hostname&quot;: &quot;G1ZTNCX3ESF&quot;,
&quot;debugMsg&quot;: &quot;PCType=Shopfloor, DNC=YES, Net=YES&quot;
}</code></pre>
<p><strong>Used By:</strong> <code>Update-ShopfloorPCs-Remote.ps1</code>, <code>Update-PC-CompleteAsset.ps1</code></p>
<hr>
<h4 id="updateprintermapping">updatePrinterMapping</h4>
<p>Links a PC to its default printer.</p>
<p><strong>Request:</strong></p>
<pre><code>POST /api.asp
Content-Type: application/x-www-form-urlencoded
action=updatePrinterMapping
&amp;hostname=G1ZTNCX3ESF
&amp;printerFQDN=printer01.domain.com</code></pre>
<p><strong>Parameters:</strong></p>
<table>
<thead><tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr></thead>
<tbody>
<tr>
<td><code>hostname</code></td>
<td>string</td>
<td>PC hostname</td>
</tr>
<tr>
<td><code>printerFQDN</code></td>
<td>string</td>
<td>Printer FQDN, Windows name, or IP</td>
</tr>
</tbody></table>
<p><strong>Response:</strong></p>
<pre><code class="language-json">{
&quot;success&quot;: true,
&quot;message&quot;: &quot;Printer mapping updated&quot;,
&quot;printerId&quot;: 45,
&quot;machinesUpdated&quot;: 1,
&quot;matchMethod&quot;: &quot;fqdn&quot;
}</code></pre>
<p><strong>Match Methods:</strong> <code>fqdn</code>, <code>windowsname</code>, <code>ip</code></p>
<hr>
<h4 id="updateinstalledapps">updateInstalledApps</h4>
<p>Updates the list of tracked applications installed on a PC.</p>
<p><strong>Request:</strong></p>
<pre><code>POST /api.asp
Content-Type: application/x-www-form-urlencoded
action=updateInstalledApps
&amp;hostname=G1ZTNCX3ESF
&amp;installedApps=[{&quot;appid&quot;:5,&quot;appname&quot;:&quot;PC-DMIS&quot;,&quot;version&quot;:&quot;2023.1&quot;,&quot;isactive&quot;:1}]</code></pre>
<p><strong>Parameters:</strong></p>
<table>
<thead><tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr></thead>
<tbody>
<tr>
<td><code>hostname</code></td>
<td>string</td>
<td>PC hostname</td>
</tr>
<tr>
<td><code>installedApps</code></td>
<td>JSON</td>
<td>Array of tracked applications</td>
</tr>
</tbody></table>
<p><strong>Response:</strong></p>
<pre><code class="language-json">{
&quot;success&quot;: true,
&quot;message&quot;: &quot;Installed apps updated&quot;,
&quot;appsUpdated&quot;: 3
}</code></pre>
<hr>
<h4 id="updatewinrmstatus">updateWinRMStatus</h4>
<p>Updates the WinRM enabled status for a PC.</p>
<p><strong>Request:</strong></p>
<pre><code>POST /api.asp
Content-Type: application/x-www-form-urlencoded
action=updateWinRMStatus
&amp;hostname=G1ZTNCX3ESF
&amp;hasWinRM=1</code></pre>
<p><strong>Parameters:</strong></p>
<table>
<thead><tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr></thead>
<tbody>
<tr>
<td><code>hostname</code></td>
<td>string</td>
<td>PC hostname</td>
</tr>
<tr>
<td><code>hasWinRM</code></td>
<td>int</td>
<td>WinRM status (0=disabled, 1=enabled)</td>
</tr>
</tbody></table>
<p><strong>Response:</strong></p>
<pre><code class="language-json">{
&quot;success&quot;: true,
&quot;message&quot;: &quot;WinRM status updated&quot;,
&quot;hostname&quot;: &quot;G1ZTNCX3ESF&quot;,
&quot;iswinrm&quot;: 1
}</code></pre>
<hr>
<h4 id="updatemachinepositions">updateMachinePositions</h4>
<p>Bulk update machine positions on the floor map.</p>
<p><strong>Request:</strong></p>
<pre><code>POST /api.asp
Content-Type: application/x-www-form-urlencoded
action=updateMachinePositions
&amp;changes=[{&quot;machineid&quot;:1234,&quot;mapleft&quot;:100,&quot;maptop&quot;:200}]</code></pre>
<p><strong>Parameters:</strong></p>
<table>
<thead><tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr></thead>
<tbody>
<tr>
<td><code>changes</code></td>
<td>JSON</td>
<td>Array of position updates</td>
</tr>
</tbody></table>
<p><strong>Response:</strong></p>
<pre><code class="language-json">{
&quot;success&quot;: true,
&quot;updated&quot;: 5
}</code></pre>
<hr>
<h2 id="response-format">Response Format</h2>
<p>All responses are JSON with consistent structure:</p>
<p><strong>Success Response:</strong></p>
<pre><code class="language-json">{
&quot;success&quot;: true,
&quot;message&quot;: &quot;Operation completed&quot;,
&quot;data&quot;: [...]
}</code></pre>
<p><strong>Error Response:</strong></p>
<pre><code class="language-json">{
&quot;success&quot;: false,
&quot;error&quot;: &quot;Error description&quot;
}</code></pre>
<hr>
<h2 id="error-handling">Error Handling</h2>
<table>
<thead><tr>
<th>Error</th>
<th>Cause</th>
<th>Solution</th>
</tr></thead>
<tbody>
<tr>
<td><code>hostname and serialNumber are required</code></td>
<td>Missing required fields</td>
<td>Include all required parameters</td>
</tr>
<tr>
<td><code>PC not found: hostname</code></td>
<td>Hostname not in database</td>
<td>Verify hostname or run initial collection</td>
</tr>
<tr>
<td><code>Printer not found: printerFQDN</code></td>
<td>Printer not in database</td>
<td>Add printer to ShopDB first</td>
</tr>
<tr>
<td><code>Invalid action: xyz</code></td>
<td>Unknown action parameter</td>
<td>Check action spelling</td>
</tr>
<tr>
<td><code>Database error: ...</code></td>
<td>MySQL error</td>
<td>Check database connectivity</td>
</tr>
</tbody></table>
<hr>
<h2 id="powershell-integration">PowerShell Integration</h2>
<h3 id="sending-data-to-api">Sending Data to API</h3>
<pre><code class="language-powershell"># Build POST body
$body = @{
action = &quot;updateCompleteAsset&quot;
hostname = $env:COMPUTERNAME
serialNumber = (Get-CimInstance Win32_BIOS).SerialNumber
manufacturer = (Get-CimInstance Win32_ComputerSystem).Manufacturer
model = (Get-CimInstance Win32_ComputerSystem).Model
pcType = &quot;Shopfloor&quot;
}
# Send to API
$response = Invoke-RestMethod -Uri &quot;https://server/shopdb/api.asp&quot; -Method POST -Body $body</code></pre>
<h3 id="retrieving-pc-list">Retrieving PC List</h3>
<pre><code class="language-powershell"># Get all shopfloor PCs
$response = Invoke-RestMethod -Uri &quot;https://server/shopdb/api.asp?action=getShopfloorPCs&quot;
$pcs = $response.data
# Get CMM PCs only
$response = Invoke-RestMethod -Uri &quot;https://server/shopdb/api.asp?action=getShopfloorPCs&amp;pctypeid=2&quot;
# Get high uptime PCs
$response = Invoke-RestMethod -Uri &quot;https://server/shopdb/api.asp?action=getHighUptimePCs&amp;minUptime=30&quot;</code></pre>
<h3 id="script-usage-examples">Script Usage Examples</h3>
<pre><code class="language-powershell"># Update-ShopfloorPCs-Remote.ps1 uses getShopfloorPCs
.\Update-ShopfloorPCs-Remote.ps1 -All -Credential $cred
# Internally calls: GET /api.asp?action=getShopfloorPCs
# Reboot mode uses getHighUptimePCs
.\Update-ShopfloorPCs-Remote.ps1 -Reboot -MinUptimeDays 30
# Internally calls: GET /api.asp?action=getHighUptimePCs&amp;minUptime=30
# Invoke-RemoteMaintenance.ps1 filters by PC type
.\Invoke-RemoteMaintenance.ps1 -PcType CMM -Task DiskCleanup
# Internally calls: GET /api.asp?action=getShopfloorPCs&amp;pctypeid=2</code></pre>
<hr>
<h2 id="database-schema-reference">Database Schema Reference</h2>
<p>The API interacts with these primary tables:</p>
<table>
<thead><tr>
<th>Table</th>
<th>Purpose</th>
</tr></thead>
<tbody>
<tr>
<td><code>machines</code></td>
<td>All PCs and equipment (pctypeid IS NOT NULL for PCs)</td>
</tr>
<tr>
<td><code>communications</code></td>
<td>Network interfaces (IP, MAC, gateway)</td>
</tr>
<tr>
<td><code>dncconfig</code></td>
<td>DNC/FTP configurations</td>
</tr>
<tr>
<td><code>commconfig</code></td>
<td>Communication port settings</td>
</tr>
<tr>
<td><code>installedapps</code></td>
<td>Application tracking</td>
</tr>
<tr>
<td><code>pctype</code></td>
<td>PC type definitions</td>
</tr>
<tr>
<td><code>businessunits</code></td>
<td>Business unit definitions</td>
</tr>
<tr>
<td><code>printers</code></td>
<td>Printer inventory</td>
</tr>
</tbody></table>
<p><strong>PC Identification:</strong></p>
<ul>
<li>PCs have <code>machinetypeid IN (33, 34, 35)</code></li>
<li>PCs have <code>pctypeid IS NOT NULL</code></li>
<li>Primary network is <code>isprimary = 1</code> in communications table</li>
</ul>
</body>
</html>