### Hikvision API Integration Guide - Reading Order Source: https://open.hikvision.com/docs/docId?productId=5c67f1e2f05948198c909700&version=%2Ff95e951cefc54578b523d1738f65f0a1/index_productid=5c67f1e2f05948198c909700&version=%2Ff95e951cefc54578b523d1738f65f0a1 This section outlines the recommended reading order for the integration guide to help developers quickly understand and utilize the platform's open capabilities. It suggests starting with terminology and quick start guides, then moving to protocol overviews, capability overviews, programming examples, and finally, specific API details. ```English 1. Consult the [Related Terminology] section for initial understanding of professional terms. 2. Consult the [Quick Start] section for environment requirements, preparation, and sample code for API calls. 3. Consult the [Protocol Overview] section to master API invocation and event subscription methods. 4. Consult the [Capability Overview] section for a preliminary understanding of the platform's interfaces. 5. Read the [Programming Guide] section for case studies to further understand platform capabilities and application effects. 6. Confirm business requirements and assess necessary platform API capabilities. 7. Read the [API List] section to find APIs by category and understand their specific functions. 8. Develop code according to API interface definitions. ``` -------------------------------- ### Java API Call for Camera Preview URL Source: https://open.hikvision.com/docs/docId?productId=5c67f1e2f05948198c909700&version=%2Ff95e951cefc54578b523d1738f65f0a1/index_productId=5c67f1e2f05948198c909700&version=%2Ff95e951cefc54578b523d1738f65f0a1 This Java code demonstrates how to call the platform's API to get camera preview URLs. It requires setting up ArtemisConfig with host, appKey, and appSecret, defining the API endpoint, and constructing the request body. The `ArtemisHttpUtil.doPostStringArtemis` method handles the API call and authentication. ```Java import com.hikvision.artemis.sdk.ArtemisHttpUtil; import com.hikvision.artemis.sdk.config.ArtemisConfig; import java.util.HashMap; import java.util.Map; public class GetCameraPreviewURL { public static String GetCameraPreviewURL() { /** * STEP1:设置平台参数,根据实际情况,设置host appkey appsecret 三个参数. */ ArtemisConfig.host = "127.0.0.1:443"; // 平台的ip端口 ArtemisConfig.appKey = "29180881"; // 密钥appkey ArtemisConfig.appSecret = "XO0wCAYGi4KV70ybjznx";// 密钥appSecret /** * STEP2:设置OpenAPI接口的上下文 */ final String ARTEMIS_PATH = "/artemis"; /** * STEP3:设置接口的URI地址 */ final String previewURLsApi = ARTEMIS_PATH + "/api/video/v1/cameras/previewURLs"; Map path = new HashMap(2) { { put("https://", previewURLsApi);//根据现场环境部署确认是http还是https } }; /** * STEP4:设置参数提交方式 */ String contentType = "application/json"; /** * STEP5:组装请求参数 */ JSONObject jsonBody = new JSONObject(); jsonBody.put("cameraIndexCode", "748d84750e3a4a5bbad3cd4af9ed5101"); jsonBody.put("streamType", 0); jsonBody.put("protocol", "rtsp"); jsonBody.put("transmode", 1); jsonBody.put("expand", "streamform=ps"); String body = jsonBody.toJSONString(); /** * STEP6:调用接口 */ String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , null);// post请求application/json类型参数 return result; } public static void main(String[] args) { String result = GetCameraPreviewURL(); System.out.println("result结果示例: " + result); } } ``` -------------------------------- ### C++ API Call Example Source: https://open.hikvision.com/docs/docId?productId=5c67f1e2f05948198c909700&version=%2Ff95e951cefc54578b523d1738f65f0a1/index_productId=5c67f1e2f05948198c909700&version=%2Ff95e951cefc54578b523d1738f65f0a1 This C++ code provides a structure for making API calls to the platform. It defines a `Unit_query_s` struct to hold authentication and platform details (IP, Port, appKey, appSecret). The `FindIndexCodesOfAppKey` function is a placeholder for making POST requests, which internally handles login authentication. ```C++ #include "iostream" #include "sstream" #include "HttpUtillib.h" #include "HttpHeader.h" typedef struct Unit_query_s { string artemisIp; // 平台的ip地址(必填) int artemisPort; // 平台的Port(必填) string appKey; // 密钥的appKey(必填) string appSecret; // 密钥的appSecret(必填) }Unit_query_t; /*示例1:(Post)获取当前AppKey的合作方对应监控点列表*/ string FindIndexCodesOfAppKey(Unit_query_t query) { } int main() { Unit_query_t myQuery; myQuery.appKey = "26018161"; myQuery.appSecret = "tdxjiS8bNXZTOf80ymWw"; myQuery.artemisIp = "x.x.x.x"; myQuery.artemisPort = 80; //1 Post std::string str1 = FindIndexCodesOfAppKey(myQuery); std::cout << str1 << std::endl << std::endl; system("pause"); return 0; } ``` -------------------------------- ### Java: Get Camera Preview URL Source: https://open.hikvision.com/docs/docId?productId=5c67f1e2f05948198c909700&version=%2Ff95e951cefc54578b523d1738f65f0a1/index_productid=5c67f1e2f05948198c909700&version=%2Ff95e951cefc54578b523d1738f65f0a1 This Java code snippet demonstrates how to retrieve a camera preview URL from the Hikvision Comprehensive Security Management Platform. It requires the artemis-http-client.jar library and involves setting platform configuration (host, appKey, appSecret), API endpoint, request parameters, and then making a POST request using `ArtemisHttpUtil.doPostStringArtemis`. ```Java import com.hikvision.artemis.sdk.ArtemisHttpUtil; import com.hikvision.artemis.sdk.config.ArtemisConfig; import java.util.HashMap; import java.util.Map; public class GetCameraPreviewURL { public static String GetCameraPreviewURL() { /** * STEP1:设置平台参数,根据实际情况,设置host appkey appsecret 三个参数. */ ArtemisConfig.host = "127.0.0.1:443"; // 平台的ip端口 ArtemisConfig.appKey = "29180881"; // 密钥appkey ArtemisConfig.appSecret = "XO0wCAYGi4KV70ybjznx";// 密钥appSecret /** * STEP2:设置OpenAPI接口的上下文 */ final String ARTEMIS_PATH = "/artemis"; /** * STEP3:设置接口的URI地址 */ final String previewURLsApi = ARTEMIS_PATH + "/api/video/v1/cameras/previewURLs"; Map path = new HashMap(2) { { put("https://", previewURLsApi);//根据现场环境部署确认是http还是https } }; /** * STEP4:设置参数提交方式 */ String contentType = "application/json"; /** * STEP5:组装请求参数 */ JSONObject jsonBody = new JSONObject(); jsonBody.put("cameraIndexCode", "748d84750e3a4a5bbad3cd4af9ed5101"); jsonBody.put("streamType", 0); jsonBody.put("protocol", "rtsp"); jsonBody.put("transmode", 1); jsonBody.put("expand", "streamform=ps"); String body = jsonBody.toJSONString(); /** * STEP6:调用接口 */ String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , null);// post请求application/json类型参数 return result; } public static void main(String[] args) { String result = GetCameraPreviewURL(); System.out.println("result结果示例: " + result); } } ``` -------------------------------- ### C++: Find Index Codes of App Key Source: https://open.hikvision.com/docs/docId?productId=5c67f1e2f05948198c909700&version=%2Ff95e951cefc54578b523d1738f65f0a1/index_productid=5c67f1e2f05948198c909700&version=%2Ff95e951cefc54578b523d1738f65f0a1 This C++ code snippet outlines the structure for finding index codes associated with an App Key on the Hikvision platform. It requires a custom `HttpUtillib` and `HttpHeader` library, and involves defining a `Unit_query_s` struct to hold platform credentials (IP, Port, AppKey, AppSecret) and then calling a `FindIndexCodesOfAppKey` function. ```C++ #include "iostream" #include "sstream" #include "HttpUtillib.h" #include "HttpHeader.h" typedef struct Unit_query_s { string artemisIp; // 平台的ip地址(必填) int artemisPort; // 平台的Port(必填) string appKey; // 密钥的appKey(必填) string appSecret; // 密钥的appSecret(必填) }Unit_query_t; /*示例1:(Post)获取当前AppKey的合作方对应监控点列表*/ string FindIndexCodesOfAppKey(Unit_query_t query) { } int main() { Unit_query_t myQuery; myQuery.appKey = "26018161"; myQuery.appSecret = "tdxjiS8bNXZTOf80ymWw"; myQuery.artemisIp = "x.x.x.x"; myQuery.artemisPort = 80; //1 Post std::string str1 = FindIndexCodesOfAppKey(myQuery); std::cout << str1 << std::endl << std::endl; system("pause"); return 0; } ``` -------------------------------- ### Hikvision Device Integration SDK Source: https://open.hikvision.com/docs/docId?productId=5c67f1e2f05948198c909700&version=%2Ff95e951cefc54578b523d1738f65f0a1/index_productId=5c67f1e2f05948198c909700&version=%2Ff95e951cefc54578b523d1738f65f0a1 Provides Software Development Kits (SDKs) for integrating with Hikvision devices. This enables developers to access device functionalities and data streams. ```Android icon-sdk-android ``` ```C++ icon-sdk-c++ ``` ```iOS icon-sdk-ios ``` -------------------------------- ### Hikvision Video Integration Source: https://open.hikvision.com/docs/docId?productId=5c67f1e2f05948198c909700&version=%2Ff95e951cefc54578b523d1738f65f0a1/index_productId=5c67f1e2f05948198c909700&version=%2Ff95e951cefc54578b523d1738f65f0a1 Information and tools for integrating video capabilities from Hikvision devices and platforms. This includes accessing video streams and related functionalities. ```Video icon-sdk-视频 ``` ```Video Plugin icon-sdk-视频插件 ``` -------------------------------- ### Java Maven Dependency for Hikvision SDK Source: https://open.hikvision.com/docs/docId?productId=5c67f1e2f05948198c909700&version=%2Ff95e951cefc54578b523d1738f65f0a1/index_productId=5c67f1e2f05948198c909700&version=%2Ff95e951cefc54578b523d1738f65f0a1 This snippet shows the Maven dependency required to include the Hikvision OpenAPI security authentication library (Java) in your project. It specifies the group ID, artifact ID, and version for the `artemis-http-client.jar`. ```XML com.hikvision.ga artemis-http-client 1.1.3 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.