5. Site Service
Access via client.site(). A site (factory) is an asset node located directly below the enterprise level (asset_type=S), and all OPC, Asset, Tag, and Order entities belong to a site.
There is only one enterprise per installation. The enterprise_id of a site refers to that enterprise, meaning the parent of a site node is the enterprise.
Attempts to create a second enterprise or delete the only existing enterprise will be rejected with 409 (enterprise.only_one)—however, the name and attributes can be modified.
ID Rule: The
SITE_prefix is mandatory. For more details, refer to Domain ID Rules.
5.1 Method List
| Method | Return Type | HTTP | Endpoint |
|---|---|---|---|
create(SiteRequestV5) | SiteResponseV5 or null | POST | /api/v5/site |
update(site_id, SiteRequestV5) | SiteResponseV5 or null | PUT | /api/v5/site/{id} |
delete(site_id) | boolean | DELETE | /api/v5/site/{id} |
get(site_id) | SiteResponseV5 or null | GET | /api/v5/site/{id} |
list() | List<SiteResponseV5> | GET | /api/v5/site |
exists(site_id) | boolean | GET | /api/v5/site/{id}/exists |
5.2 SiteRequestV5 (Request DTO)
| Field | Type | Required | Description |
|---|---|---|---|
site_id | String | ✅ | Starts with SITE_ |
site_name | String | ✅ | Site name |
description | String | - | Description |
lat / lng | String | - | Latitude/Longitude (for map) |
enterprise_id | String | - | Enterprise ID (ISA-95 Enterprise, e.g., ENTERPRISE_01) |
site_code | String | - | Factory code used by ERP/MES (max 50 chars) |
operational_status_code | String | - | Operation status — PLANNED · COMMISSIONING · IN_OPERATION · STANDBY · OUT_OF_SERVICE · DECOMMISSIONED |
external_system / external_id | String | - | Identification numbers used by other systems. Provide both or leave both empty |
timezone | String | - | IANA Timezone. If empty, defaults to installation timezone (PP_TZ) |
country | String | - | ISO 3166-1 alpha-2 country code |
address | String | - | Address (max 500 chars) |
5.3 SiteResponseV5 (Response DTO)
Includes the request fields above plus the following additional fields:
| Field | Type | Description |
|---|---|---|
insert_date / update_date | String | Registration/Modification timestamp |
total_area_count | int | Number of Areas in the site |
total_line_count | int | Number of Lines |
total_equipment_count | int | Number of equipment |
total_tag_count | int | Number of tags |
5.4 Usage Examples
Create Site
import plantpulse.api.v5.dto.request.SiteRequestV5;
import plantpulse.api.v5.dto.response.SiteResponseV5;
SiteRequestV5 req = new SiteRequestV5();
req.setSite_id("SITE_DJ");
req.setSite_name("대전 1공장");
req.setDescription("주력 생산 공장");
req.setLat("36.3504");
req.setLng("127.3845");
SiteResponseV5 created = client.site().create(req);
if (created != null) {
System.out.println("등록 완료: " + created.getSite_id());
}
Single Inquiry
SiteResponseV5 site = client.site().get("SITE_DJ");
if (site != null) {
System.out.println(site.getSite_name());
System.out.println("Area 수: " + site.getTotal_area_count());
System.out.println("Line 수: " + site.getTotal_line_count());
System.out.println("Equipment 수: " + site.getTotal_equipment_count());
System.out.println("Tag 수: " + site.getTotal_tag_count());
}
Full List
import java.util.List;
List<SiteResponseV5> sites = client.site().list();
for (SiteResponseV5 s : sites) {
System.out.println(s.getSite_id() + " — " + s.getSite_name());
}
Modify Site
SiteRequestV5 update = new SiteRequestV5();
update.setSite_id("SITE_DJ"); // 동일하게 채워서 보내야 합니다
update.setSite_name("대전 1공장 (확장)");
update.setDescription("2026년 라인 증설 완료");
SiteResponseV5 updated = client.site().update("SITE_DJ", update);
Check Existence
if (client.site().exists("SITE_DJ")) {
// ...
}
Delete Site
⚠️ Before deleting a site, all associated Asset, OPC, Tag, and Order entities must be deleted first. Otherwise, a
E1200(CONFLICT) response will be received andfalsewill be returned.
boolean ok = client.site().delete("SITE_OLD");
if (!ok) {
System.err.println("삭제 실패 — 하위 리소스 존재 가능");
}
5.5 Application Scenarios
Scenario — Site-specific KPI Dashboard
for (SiteResponseV5 site : client.site().list()) {
String siteId = site.getSite_id();
// 사이트별 자산 통계는 SiteResponseV5에 이미 포함됨
int eqCount = site.getTotal_equipment_count();
int tagCount = site.getTotal_tag_count();
// 사이트별 OPC 수
long opcCount = client.opc().countBySite(siteId);
System.out.printf("%s — Equipment %d, Tag %d, OPC %d%n",
site.getSite_name(), eqCount, tagCount, opcCount);
}
Next Steps
- Asset Service — Establish Area/Line/Equipment trees
- OPC Service — Register data collection channels