Skip to main content

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​

MethodReturn TypeHTTPEndpoint
create(SiteRequestV5)SiteResponseV5 or nullPOST/api/v5/site
update(site_id, SiteRequestV5)SiteResponseV5 or nullPUT/api/v5/site/{id}
delete(site_id)booleanDELETE/api/v5/site/{id}
get(site_id)SiteResponseV5 or nullGET/api/v5/site/{id}
list()List<SiteResponseV5>GET/api/v5/site
exists(site_id)booleanGET/api/v5/site/{id}/exists

5.2 SiteRequestV5 (Request DTO)​

FieldTypeRequiredDescription
site_idString✅Starts with SITE_
site_nameString✅Site name
descriptionString-Description
lat / lngString-Latitude/Longitude (for map)
enterprise_idString-Enterprise ID (ISA-95 Enterprise, e.g., ENTERPRISE_01)
site_codeString-Factory code used by ERP/MES (max 50 chars)
operational_status_codeString-Operation status — PLANNED · COMMISSIONING · IN_OPERATION · STANDBY · OUT_OF_SERVICE · DECOMMISSIONED
external_system / external_idString-Identification numbers used by other systems. Provide both or leave both empty
timezoneString-IANA Timezone. If empty, defaults to installation timezone (PP_TZ)
countryString-ISO 3166-1 alpha-2 country code
addressString-Address (max 500 chars)

5.3 SiteResponseV5 (Response DTO)​

Includes the request fields above plus the following additional fields:

FieldTypeDescription
insert_date / update_dateStringRegistration/Modification timestamp
total_area_countintNumber of Areas in the site
total_line_countintNumber of Lines
total_equipment_countintNumber of equipment
total_tag_countintNumber 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 and false will 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​