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>
876 lines
24 KiB
HTML
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">{
|
|
"success": true,
|
|
"message": "ShopDB API is online - v13 (inlined all queries)",
|
|
"version": "1.0",
|
|
"schema": "Phase 2",
|
|
"connStatus": "objConn is Open"
|
|
}</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&pctypeid=1
|
|
GET /api.asp?action=getShopfloorPCs&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">{
|
|
"success": true,
|
|
"count": 45,
|
|
"data": [
|
|
{
|
|
"machineid": 1234,
|
|
"hostname": "G1ZTNCX3ESF",
|
|
"machinenumber": "M0612, M0613",
|
|
"serialnumber": "ABC1234567",
|
|
"ipaddress": "10.134.50.101",
|
|
"loggedinuser": "DOMAIN\\jsmith",
|
|
"pctype": "Shopfloor",
|
|
"pctypeid": 1,
|
|
"businessunit": "Rotor",
|
|
"businessunitid": 2,
|
|
"lastupdated": "1/15/2025 8:30 AM"
|
|
}
|
|
]
|
|
}</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&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">{
|
|
"success": true,
|
|
"count": 5,
|
|
"minUptime": 30,
|
|
"data": [
|
|
{
|
|
"machineid": 1234,
|
|
"hostname": "SHOPFLOOR-01",
|
|
"machinenumber": "M0612",
|
|
"serialnumber": "ABC1234567",
|
|
"ipaddress": "10.134.50.101",
|
|
"loggedinuser": "DOMAIN\\jsmith",
|
|
"pctype": "Shopfloor",
|
|
"uptime_days": 45,
|
|
"lastboottime": "2024-12-01 08:00:00",
|
|
"pctypeid": 1,
|
|
"businessunit": "Rotor",
|
|
"businessunitid": 2,
|
|
"lastupdated": "1/15/2025 8:30 AM"
|
|
}
|
|
]
|
|
}</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&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">{
|
|
"success": true,
|
|
"hostname": "G1ZTNCX3ESF",
|
|
"ipaddress": "10.134.50.101"
|
|
}</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">{
|
|
"success": true,
|
|
"count": 25,
|
|
"data": [
|
|
{
|
|
"pc_machineid": 1234,
|
|
"pc_hostname": "G1ZTNCX3ESF",
|
|
"equipment_machineid": 5678,
|
|
"equipment_machinenumber": "M0612"
|
|
}
|
|
]
|
|
}</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
|
|
&hostname=G1ZTNCX3ESF
|
|
&serialNumber=ABC1234567
|
|
&manufacturer=Dell Inc.
|
|
&model=OptiPlex 7080
|
|
&pcType=Shopfloor
|
|
&loggedInUser=DOMAIN\jsmith
|
|
&machineNo=M0612
|
|
&osVersion=Microsoft Windows 10 Enterprise
|
|
&lastBootTime=2025-01-15 08:30:00
|
|
&hasVnc=1
|
|
&hasWinRM=1
|
|
&networkInterfaces=[...]
|
|
&dncConfig=[...]
|
|
&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">[
|
|
{
|
|
"interfaceName": "Ethernet0",
|
|
"ipAddress": "10.134.50.101",
|
|
"subnetMask": "24",
|
|
"defaultGateway": "10.134.50.1",
|
|
"macAddress": "00-11-22-33-44-55",
|
|
"isDhcp": 0,
|
|
"isActive": 1,
|
|
"isMachineNetwork": 0,
|
|
"isPrimary": 1
|
|
}
|
|
]</code></pre>
|
|
<p><strong>DNC Config JSON Format:</strong></p>
|
|
<pre><code class="language-json">{
|
|
"site": "WJF",
|
|
"cnc": "FANUC",
|
|
"ncif": "FOCAS2",
|
|
"machineNo": "M0612",
|
|
"ftpPrimary": "10.134.50.10",
|
|
"ftpSecondary": "10.134.50.11"
|
|
}</code></pre>
|
|
<p><strong>Installed Apps JSON Format:</strong></p>
|
|
<pre><code class="language-json">[
|
|
{
|
|
"appid": 5,
|
|
"appname": "PC-DMIS",
|
|
"version": "2023.1",
|
|
"isactive": 1
|
|
}
|
|
]</code></pre>
|
|
<p><strong>Response:</strong></p>
|
|
<pre><code class="language-json">{
|
|
"success": true,
|
|
"message": "PC data stored successfully",
|
|
"pcid": 1234,
|
|
"hostname": "G1ZTNCX3ESF",
|
|
"debugMsg": "PCType=Shopfloor, DNC=YES, Net=YES"
|
|
}</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
|
|
&hostname=G1ZTNCX3ESF
|
|
&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">{
|
|
"success": true,
|
|
"message": "Printer mapping updated",
|
|
"printerId": 45,
|
|
"machinesUpdated": 1,
|
|
"matchMethod": "fqdn"
|
|
}</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
|
|
&hostname=G1ZTNCX3ESF
|
|
&installedApps=[{"appid":5,"appname":"PC-DMIS","version":"2023.1","isactive":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">{
|
|
"success": true,
|
|
"message": "Installed apps updated",
|
|
"appsUpdated": 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
|
|
&hostname=G1ZTNCX3ESF
|
|
&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">{
|
|
"success": true,
|
|
"message": "WinRM status updated",
|
|
"hostname": "G1ZTNCX3ESF",
|
|
"iswinrm": 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
|
|
&changes=[{"machineid":1234,"mapleft":100,"maptop":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">{
|
|
"success": true,
|
|
"updated": 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">{
|
|
"success": true,
|
|
"message": "Operation completed",
|
|
"data": [...]
|
|
}</code></pre>
|
|
<p><strong>Error Response:</strong></p>
|
|
<pre><code class="language-json">{
|
|
"success": false,
|
|
"error": "Error description"
|
|
}</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 = "updateCompleteAsset"
|
|
hostname = $env:COMPUTERNAME
|
|
serialNumber = (Get-CimInstance Win32_BIOS).SerialNumber
|
|
manufacturer = (Get-CimInstance Win32_ComputerSystem).Manufacturer
|
|
model = (Get-CimInstance Win32_ComputerSystem).Model
|
|
pcType = "Shopfloor"
|
|
}
|
|
|
|
# Send to API
|
|
$response = Invoke-RestMethod -Uri "https://server/shopdb/api.asp" -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 "https://server/shopdb/api.asp?action=getShopfloorPCs"
|
|
$pcs = $response.data
|
|
|
|
# Get CMM PCs only
|
|
$response = Invoke-RestMethod -Uri "https://server/shopdb/api.asp?action=getShopfloorPCs&pctypeid=2"
|
|
|
|
# Get high uptime PCs
|
|
$response = Invoke-RestMethod -Uri "https://server/shopdb/api.asp?action=getHighUptimePCs&minUptime=30"</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&minUptime=30
|
|
|
|
# Invoke-RemoteMaintenance.ps1 filters by PC type
|
|
.\Invoke-RemoteMaintenance.ps1 -PcType CMM -Task DiskCleanup
|
|
# Internally calls: GET /api.asp?action=getShopfloorPCs&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> |