### Callback Body Example Source: https://github.com/qiniu/java-sdk/blob/master/examples/关于回调流程.md This is an example of the callback body format that can be set in the upload policy. It specifies the metadata to be sent to the callback URL. ```text "hash=$(etag)&key=$(key)&fsize=$(fsize)&mimeType=$(mimeType)" ``` -------------------------------- ### Start Device Pull Stream Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Starts pulling streams from a specified device within a namespace. ```APIDOC ## Start Device Pull Stream ### Description Starts pulling streams from a specified device within a namespace. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace. - **gbId** (string) - Required - The GB ID of the device. - **channelId** (string) - Required - The ID of the channel to pull stream from. ### Request Example ```java deviceManager.startDevice(namespaceId, device.getGbId(), "31011500991320000056"); ``` ### Response Not specified ``` -------------------------------- ### Start Device Pull Stream Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Starts pulling streams from a specific device within a namespace using its GB ID. ```Java // 启动设备拉流 deviceManager.startDevice(namespaceId, device.getGbId(), "31011500991320000056"); ``` -------------------------------- ### Query Device Access Key (DAK) List Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/linking/README.md Get a list of Device Access Keys (DAKs) associated with a device using deviceManager.queryDeviceKey. ```java DeviceKey[] keys = deviceManager.queryDeviceKey(appid,deviceName); ``` -------------------------------- ### Get Static Stream URL Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Generates a static URL for publishing or playing a stream. Requires stream details and a StaticLiveRoute configuration. ```Java // 静态模式获取流地址 StaticLiveRoute staticLiveRoute = new StaticLiveRoute("qvs-publish.qtest.com", "publishRtmp", 3600); streamManager.staticPublishPlayURL(namespaceId, stream.getStreamID(), staticLiveRoute); ``` -------------------------------- ### Get Dynamic Stream URL Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Generates a dynamic URL for publishing or playing a stream. Requires stream details and a DynamicLiveRoute configuration. ```Java // 动态模式获取流地址 DynamicLiveRoute dynamicLiveRoute = new DynamicLiveRoute("127.0.0.1", "127.0.0.1", 0); streamManager.dynamicPublishPlayURL(namespaceId, stream.getStreamID(), dynamicLiveRoute); ``` -------------------------------- ### Get Dynamic Stream URL Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Obtains a stream URL for dynamic mode, specifying IP addresses. ```APIDOC ## Get Dynamic Stream URL ### Description Obtains a stream URL for dynamic mode, specifying IP addresses. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace. - **streamId** (string) - Required - The ID of the stream. #### Request Body - **dynamicLiveRoute** (DynamicLiveRoute object) - Required - Object containing dynamic route details. - **domain** (string) - Required - The domain name for the stream URL. - **protocol** (string) - Required - The protocol for the stream URL. - **ttl** (integer) - Required - The time-to-live for the URL in seconds. ### Request Example ```java DynamicLiveRoute dynamicLiveRoute = new DynamicLiveRoute("127.0.0.1", "127.0.0.1", 0); streamManager.dynamicPublishPlayURL(namespaceId, stream.getStreamID(), dynamicLiveRoute); ``` ### Response Not specified ``` -------------------------------- ### Get Static Stream URL Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Obtains a stream URL for static mode, specifying the protocol and expiration time. ```APIDOC ## Get Static Stream URL ### Description Obtains a stream URL for static mode, specifying the protocol and expiration time. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace. - **streamId** (string) - Required - The ID of the stream. #### Request Body - **staticLiveRoute** (StaticLiveRoute object) - Required - Object containing static route details. - **domain** (string) - Required - The domain name for the stream URL. - **protocol** (string) - Required - The protocol for the stream URL (e.g., "publishRtmp"). - **ttl** (integer) - Required - The time-to-live for the URL in seconds. ### Request Example ```java StaticLiveRoute staticLiveRoute = new StaticLiveRoute("qvs-publish.qtest.com", "publishRtmp", 3600); streamManager.staticPublishPlayURL(namespaceId, stream.getStreamID(), staticLiveRoute); ``` ### Response Not specified ``` -------------------------------- ### Initialize SDK Auth and Device Manager Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/linking/README.md Initialize the Auth object with your AK/SK and create an instance of LinkingDeviceManager for device operations. ```java Auth auth = Auth.create(testAk,testSk); LinkingDeviceManager deviceManager = new LinkingDeviceManager(auth); ``` -------------------------------- ### Qiniu Java SDK Upload Demo Source: https://github.com/qiniu/java-sdk/wiki/七牛JAVA-SDK:IntelliJIDEA下引入maven工程 This Java code demonstrates how to upload a file using the Qiniu SDK. You need to replace placeholder values for ACCESS_KEY, SECRET_KEY, bucketname, key, and FilePath with your actual credentials and desired settings. ```java // The following code is a demo for uploading a file using the Qiniu Java SDK. // It requires replacing placeholder values such as ACCESS_KEY, SECRET_KEY, bucketname, key, and FilePath. // ACCESS_KEY and SECRET_KEY can be obtained from https://portal.qiniu.com/user/key. // bucketname is your bucket name, create one if it doesn't exist. // key is the desired filename after upload. // FilePath is the path to the local file you want to upload. import com.qiniu.common.QiniuException; import com.qiniu.http.Response; import com.qiniu.storage.Configuration; import com.qiniu.storage.UploadManager; import com.qiniu.util.Auth; import java.io.IOException; public class UploadDemo { // Replace with your actual Access Key and Secret Key private static final String ACCESS_KEY = "YOUR_ACCESS_KEY"; private static final String SECRET_KEY = "YOUR_SECRET_KEY"; // Replace with your bucket name private static final String bucketname = "your_bucket_name"; // Replace with the desired key (filename) for the uploaded file private static final String key = "your_file_key"; // Replace with the actual path to the file you want to upload private static final String FilePath = "/path/to/your/local/file.txt"; public static void main(String[] args) { // Construct the upload token Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY); String uploadToken = auth.uploadToken(bucketname); // Configure the upload manager Configuration cfg = new Configuration(); UploadManager uploadManager = new UploadManager(cfg); try { // Perform the upload Response response = uploadManager.put(FilePath, key, uploadToken); if (response.isOK()) { System.out.println("Upload successful!"); System.out.println("Response: " + response.bodyString()); } else { System.err.println("Upload failed!"); System.err.println("Status Code: " + response.statusCode); System.err.println("Response Body: " + response.bodyString()); } } catch (QiniuException e) { System.err.println("An error occurred during upload:"); e.printStackTrace(); } catch (IOException e) { System.err.println("An IO error occurred:"); e.printStackTrace(); } } } ``` -------------------------------- ### Create Device Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Creates a new device within a specified namespace. ```APIDOC ## Create Device ### Description Creates a new device within a specified namespace. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace where the device will be created. #### Request Body - **device** (Device object) - Required - The device object containing device details. - **username** (string) - Required - The username for the device. - **password** (string) - Required - The password for the device. - **gbId** (string) - Optional - The GB ID of the device. ### Request Example ```java DeviceManager deviceManager = new DeviceManager(auth); Device device = new Device(); device.setUsername("admin"); device.setPassword("QQQNNN111"); String namespaceId = "3nm4x0v0h6vjr"; deviceManager.createDevice(namespaceId, device); ``` ### Response Not specified ``` -------------------------------- ### Create Template Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Creates a new template with specified configuration. ```APIDOC ## Create Template ### Description Creates a new template with specified configuration. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Request Body - **template** (Template object) - Required - The template object containing configuration details. - **name** (string) - Required - The name of the template. - **bucket** (string) - Required - The bucket associated with the template. - **templateType** (integer) - Required - The type of the template. - **jpgOverwriteStatus** (boolean) - Required - Whether to overwrite JPG images. - **recordType** (integer) - Required - The recording type. ### Request Example ```java Template template = new Template(); template.setName("testtemplate001"); template.setBucket("Testforhugo"); template.setTemplateType(1); template.setJpgOverwriteStatus(true); template.setRecordType(2); templateManager.createTemplate(template); ``` ### Response Not specified ``` -------------------------------- ### Create Device Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Creates a new device within a specified namespace. Requires device credentials and namespace ID. ```Java // 创建设备 DeviceManager deviceManager = new DeviceManager(auth); Device device = new Device(); device.setUsername("admin"); device.setPassword("QQQNNN111"); String namespaceId = "3nm4x0v0h6vjr"; deviceManager.createDevice(namespaceId, device); ``` -------------------------------- ### Create a New Gateway Device Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/linking/README.md Create a new gateway device by instantiating a Device object, setting its properties, and then calling deviceManager.createDevice. ```java Device device = new Device(); device.setDeviceName("testName"); device.setType(1); device.setMaxChannel(64); deviceManager.createDevice(appid, device); ``` -------------------------------- ### Create Template Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Creates a new template with specified properties like name, bucket, type, and recording status. ```Java // 创建模板 Template template = new Template(); template.setName("testtemplate001"); template.setBucket("Testforhugo"); template.setTemplateType(1); template.setJpgOverwriteStatus(true); template.setRecordType(2); templateManager.createTemplate(template); ``` -------------------------------- ### Java Servlet for Handling Callbacks Source: https://github.com/qiniu/java-sdk/blob/master/examples/关于回调流程.md This Java servlet code demonstrates how a business server can receive callback information from Qiniu after a successful upload and how to respond with a JSON object. ```java public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); //接收七牛回调过来的内容 String line=""; BufferedReader br=new BufferedReader(new InputStreamReader(request.getInputStream())); StringBuilder sb = new StringBuilder(); while((line = br.readLine())!=null){ sb.append(line); } System.out.println(sb);//打印回调内容 //设置返回给七牛的json格式的数据 JsonObject json=new JsonObject(); json.addProperty("response", "success"); out.println(json.toString()); out.flush(); out.close(); } ``` -------------------------------- ### Create a New Device Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/linking/README.md Use deviceManager.createDevice to register a new device with the specified app ID and device name. ```java deviceManager.createDevice(appid,deviceName); ``` -------------------------------- ### List Devices Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Retrieves a list of devices within a namespace, with options for filtering. ```APIDOC ## List Devices ### Description Retrieves a list of devices within a namespace, with options for filtering. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace. #### Query Parameters - **offset** (integer) - Optional - The starting offset for the list. - **line** (integer) - Optional - The number of items to return per page. - **prefix** (string) - Optional - Filter devices by prefix. - **state** (string) - Optional - Filter devices by state (e.g., "notReg"). - **qtype** (integer) - Optional - Query type. ### Request Example ```java int offset = 0; int line = 3; int qtype = 0; String prefix = "310"; String state = "notReg"; deviceManager.listDevice(namespaceId, offset, line, prefix, state, qtype); ``` ### Response Not specified ``` -------------------------------- ### Enable Namespace Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Enables a specific namespace using its ID. ```Java // 启用空间 nameSpaceManager.enableNameSpace(namespaceId); ``` -------------------------------- ### Query Device by Access Key (DAK) Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/linking/README.md Retrieve device information using its Device Access Key (DAK) via deviceManager.getDeviceByAccessKey. ```java Device device = deviceManager.getDeviceByAccessKey(dak); ``` -------------------------------- ### Enable Namespace Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Enables a specified namespace using its ID. ```APIDOC ## Enable Namespace ### Description Enables a specified namespace. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace to enable. ### Request Example ```java nameSpaceManager.enableNameSpace(namespaceId); ``` ### Response Not specified ``` -------------------------------- ### Add Device Access Key (DAK) Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/linking/README.md Add a Device Access Key (DAK) for a device using deviceManager.addDeviceKey. This returns an array of DeviceKey objects. ```java DeviceKey[] keys = deviceManager.addDeviceKey(appid,deviceName); ``` -------------------------------- ### List Templates Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Retrieves a list of templates with options for pagination, template type, and matching string. ```Java // 获取模板列表 int offset = 0; int line = 1; int templateType = 1; String match = "test"; templateManager.listTemplate(offset, line, templateType, match); ``` -------------------------------- ### Enable Stream Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Enables a specified stream within a namespace. ```APIDOC ## Enable Stream ### Description Enables a specified stream within a namespace. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace. - **streamId** (string) - Required - The ID of the stream to enable. ### Request Example ```java streamManager.enableStream(namespaceId, stream.getStreamID()); ``` ### Response Not specified ``` -------------------------------- ### Query Device Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Queries for a specific device within a namespace using its GB ID. ```Java // 查询设备 device.setGbId("31011500991320000056"); deviceManager.queryDevice(namespaceId, device.getGbId()); ``` -------------------------------- ### Create Stream Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Creates a new stream within a specified namespace. ```APIDOC ## Create Stream ### Description Creates a new stream within a specified namespace. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace where the stream will be created. #### Request Body - **stream** (Stream object) - Required - The stream object containing stream details. - **streamID** (string) - The ID of the stream. - **desc** (string) - Optional - Description of the stream. ### Request Example ```java Stream stream = new Stream("teststream004"); String namespaceId = "2akrarsj8zp0w"; streamManager.createStream(namespaceId, stream); ``` ### Response Not specified ``` -------------------------------- ### List Channels Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Retrieves a list of channels for a specific device within a namespace. ```APIDOC ## List Channels ### Description Retrieves a list of channels for a specific device within a namespace. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace. - **gbId** (string) - Required - The GB ID of the device. #### Query Parameters - **prefix** (string) - Optional - Filter channels by prefix. ### Request Example ```java deviceManager.listChannels(namespaceId, device.getGbId(), prefix); ``` ### Response Not specified ``` -------------------------------- ### Java Servlet for Handling Qiniu Callbacks Source: https://github.com/qiniu/java-sdk/blob/master/examples/关于设置notifyURL没有收到回调.md This Java Servlet demonstrates how to correctly read the POST request body from Qiniu callbacks. Ensure your server can receive and process POST requests with a Content-Type of 'application/json'. ```java public class notify extends HttpServlet { public notify() { super(); } public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); response.setCharacterEncoding("gb2312"); PrintWriter out = response.getWriter(); request.getInputStream(); String line=""; BufferedReader br=new BufferedReader(new InputStreamReader( request.getInputStream())); StringBuilder sb = new StringBuilder(); while((line = br.readLine())!=null){ sb.append(line); } System.out.println( sb); } } ``` -------------------------------- ### List Stream Snapshots Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Retrieves a list of snapshots for a stream within a specified time range. Requires namespace, stream ID, and time parameters. ```Java // 获取截图列表 streamManager.streamsSnapshots(namespaceId, stream.getStreamID(), start, end, 0, line, maker); ``` -------------------------------- ### Query Device Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Queries for a specific device within a namespace using its GB ID. ```APIDOC ## Query Device ### Description Queries for a specific device within a namespace. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace. - **gbId** (string) - Required - The GB ID of the device to query. ### Request Example ```java device.setGbId("31011500991320000056"); deviceManager.queryDevice(namespaceId, device.getGbId()); ``` ### Response Not specified ``` -------------------------------- ### List Channels Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Retrieves a list of channels for a specific device within a namespace, with an optional prefix filter. ```Java // 禁用空间 deviceManager.listChannels(namespaceId, device.getGbId(), prefix); ``` -------------------------------- ### List Streams Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Retrieves a list of streams within a namespace, with options for pagination, filtering, and sorting. ```Java // 获取流列表 int offset = 0; int line = 1; int qtype = 0; String prefix = "test"; String sortBy = "desc:updatedAt"; streamManager.listStream(namespaceId, offset, line, qtype, prefix, sortBy); ``` -------------------------------- ### Generate Video-on-Demand (VOD) Token Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/linking/README.md Generate a dtoken specifically for accessing video-on-demand (VOD) using auth.generateLinkingDeviceVodTokenWithExpires. ```java String token = auth.generateLinkingDeviceVodTokenWithExpires(appid,deviceName,expires) ``` -------------------------------- ### List Devices Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/linking/README.md Retrieve a list of devices using deviceManager.listDevice, which returns a DeviceListing object containing device items, marker, and other pagination information. ```java DeviceListing deviceslist = deviceManager.listDevice(appid,prefix,marker,limit,online) Device[] devices = deviceslist.items; String marker = deviceslist.marker; ``` -------------------------------- ### Enable Stream Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Enables a specific stream within a namespace, allowing it to be used again. ```Java // 启用流 streamManager.enableStream(namespaceId, stream.getStreamID()); ``` -------------------------------- ### List Templates Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Retrieves a list of templates with options for filtering. ```APIDOC ## List Templates ### Description Retrieves a list of templates with options for filtering. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Query Parameters - **offset** (integer) - Optional - The starting offset for the list. - **line** (integer) - Optional - The number of items to return per page. - **templateType** (integer) - Optional - Filter by template type. - **match** (string) - Optional - Filter templates by name match. ### Request Example ```java int offset = 0; int line = 1; int templateType = 1; String match = "test"; templateManager.listTemplate(offset, line, templateType, match); ``` ### Response Not specified ``` -------------------------------- ### Generate Device Status Token Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/linking/README.md Generate a dtoken for retrieving device status, which can also include VOD and TUTK actions, using auth.generateLinkingDeviceStatusTokenWithExpires. ```java String[] actions = new String[]{Auth.DTOKEN_ACTION_STATUS,Auth.DTOKEN_ACTION_VOD,Auth.DTOKEN_ACTION_TUTK}; String token = auth.generateLinkingDeviceStatusTokenWithExpires(appid,deviceName,expires) ``` -------------------------------- ### Update Device Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Updates an existing device within a namespace. ```APIDOC ## Update Device ### Description Updates an existing device within a namespace. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace. - **gbId** (string) - Required - The GB ID of the device to update. #### Request Body - **patchOperation** (PatchOperation array) - Required - An array of patch operations to apply to the device. - **op** (string) - Required - The operation type (e.g., "replace"). - **path** (string) - Required - The path to the field to update. - **value** (any) - Required - The new value for the field. ### Request Example ```java PatchOperation[] patchOperation = {new PatchOperation("replace", "name", "GBTEST")}; deviceManager.updateDevice(namespaceId, device.getGbId(), patchOperation); ``` ### Response Not specified ``` -------------------------------- ### Query Device Information Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/linking/README.md Fetch details of a specific device by its app ID and device name using deviceManager.getDevice. ```java Device device = deviceManager.getDevice(appid,deviceName); ``` -------------------------------- ### Query Stream Cover Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Queries for the cover image of a specific stream within a namespace. ```Java // 查询流封面 streamManager.queryStreamCover(namespaceId, stream.getStreamID()); ``` -------------------------------- ### Clone Device Access Key (DAK) Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/linking/README.md Move a Device Access Key (DAK) from one device to another using deviceManager.cloneDeviceKey. Parameters control whether to clean self keys and delete the original device. ```java deviceManager.cloneDeviceKey(appid,fromDeviceName,toDeviceName2,true, false,dak) ``` -------------------------------- ### Generate Multi-Function Device Token Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/linking/README.md Generate a dtoken with multiple functionalities (e.g., status, VOD, TUTK) using auth.generateLinkingDeviceTokenWithExpires. ```java String[] = new String token = auth.generateLinkingDeviceTokenWithExpires(appid,deviceName,expires,actions); ``` -------------------------------- ### Create Stream Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Creates a new stream within a specified namespace. Requires a Stream object with a name and the namespace ID. ```Java // 创建流 Stream stream = new Stream("teststream004"); String namespaceId = "2akrarsj8zp0w"; streamManager.createStream(namespaceId, stream); ``` -------------------------------- ### List Stream Snapshots Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Retrieves a list of snapshots for a stream within a given time range. ```APIDOC ## List Stream Snapshots ### Description Retrieves a list of snapshots for a stream within a given time range. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace. - **streamId** (string) - Required - The ID of the stream. #### Query Parameters - **start** (integer) - Required - The start timestamp for the query. - **end** (integer) - Required - The end timestamp for the query. - **qtype** (integer) - Optional - Query type. - **line** (integer) - Optional - The number of items to return per page. - **maker** (string) - Optional - Filter by maker. ### Request Example ```java streamManager.streamsSnapshots(namespaceId, stream.getStreamID(), start, end, 0, line, maker); ``` ### Response Not specified ``` -------------------------------- ### Query Recording Histories Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Queries for recording histories of a stream within a specified time range. Requires namespace, stream ID, and time parameters. ```Java // 查询录制记录 int start = 1587975463; int end = 1587976463; String maker = ""; streamManager.queryStreamRecordHistories(namespaceId, stream.getStreamID(), start, end, line, maker); ``` -------------------------------- ### Query Template Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Queries for a specific template using its template ID. ```Java // 查询模板 String templateId = "2akrarsl22iil"; templateManager.queryTemplate(templateId); ``` -------------------------------- ### Add Qiniu Java SDK Dependency to Maven pom.xml Source: https://github.com/qiniu/java-sdk/wiki/七牛JAVA-SDK:IntelliJIDEA下引入maven工程 Include this dependency in your pom.xml file to add the Qiniu Java SDK to your Maven project. Ensure your project is configured to auto-import Maven changes. ```xml 4.0.0 org.example java-sdk-demo01 1.0-SNAPSHOT com.qiniu qiniu-java-sdk [7.2.0, 7.2.99] ``` -------------------------------- ### List Streams Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Retrieves a list of streams within a namespace, with options for filtering and sorting. ```APIDOC ## List Streams ### Description Retrieves a list of streams within a namespace, with options for filtering and sorting. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace. #### Query Parameters - **offset** (integer) - Optional - The starting offset for the list. - **line** (integer) - Optional - The number of items to return per page. - **qtype** (integer) - Optional - Query type. - **prefix** (string) - Optional - Filter streams by prefix. - **sortBy** (string) - Optional - Field to sort by (e.g., "desc:updatedAt"). ### Request Example ```java int offset = 0; int line = 1; int qtype = 0; String prefix = "test"; String sortBy = "desc:updatedAt"; streamManager.listStream(namespaceId, offset, line, qtype, prefix, sortBy); ``` ### Response Not specified ``` -------------------------------- ### Query Template Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Queries for a specific template using its ID. ```APIDOC ## Query Template ### Description Queries for a specific template using its ID. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **templateId** (string) - Required - The ID of the template to query. ### Request Example ```java String templateId = "2akrarsl22iil"; templateManager.queryTemplate(templateId); ``` ### Response Not specified ``` -------------------------------- ### Query Stream Cover Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Queries for the cover image of a specific stream. ```APIDOC ## Query Stream Cover ### Description Queries for the cover image of a specific stream. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace. - **streamId** (string) - Required - The ID of the stream. ### Request Example ```java streamManager.queryStreamCover(namespaceId, stream.getStreamID()); ``` ### Response Not specified ``` -------------------------------- ### Update Device Information Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/linking/README.md Update device information using deviceManager.updateDevice with an array of PatchOperation objects. This returns the updated device object. ```java PatchOperation[] operations={new PatchOperation("replace","segmentExpireDays",9)}; Device device= deviceManager.updateDevice(appid,deviceName,operations); //返回更新后的设备 ``` -------------------------------- ### Update Device Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Updates an existing device using patch operations. Allows modification of device properties like name. ```Java // 更新设备 PatchOperation[] patchOperation = {new PatchOperation("replace", "name", "GBTEST")}; deviceManager.updateDevice(namespaceId, device.getGbId(), patchOperation); ``` -------------------------------- ### Query Stream Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Queries for a specific stream within a namespace using the namespace ID and stream ID. ```Java // 查询流 streamManager.queryStream(namespaceId, stream.getStreamID()); ``` -------------------------------- ### Delete Device Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Deletes a specific device from a namespace using its GB ID. ```Java deviceManager.deleteDevice(namespaceId, device.getGbId()); ``` -------------------------------- ### Delete Device Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Deletes a specified device from a namespace using its GB ID. ```APIDOC ## Delete Device ### Description Deletes a specified device from a namespace. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace. - **gbId** (string) - Required - The GB ID of the device to delete. ### Request Example ```java deviceManager.deleteDevice(namespaceId, device.getGbId()); ``` ### Response Not specified ``` -------------------------------- ### Query Stream Push History Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Queries the historical push data for a specific stream within a given time range. ```Java // 查询推流历史记录 streamManager.queryStreamPubHistories(namespaceId, stream.getStreamID(), start, end, offset, line); ``` -------------------------------- ### Query Stream Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Queries for a specific stream within a namespace using its ID. ```APIDOC ## Query Stream ### Description Queries for a specific stream within a namespace. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace. - **streamId** (string) - Required - The ID of the stream to query. ### Request Example ```java streamManager.queryStream(namespaceId, stream.getStreamID()); ``` ### Response Not specified ``` -------------------------------- ### Query Stream Push History Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Queries the push history records for a specific stream. ```APIDOC ## Query Stream Push History ### Description Queries the push history records for a specific stream. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace. - **streamId** (string) - Required - The ID of the stream. #### Query Parameters - **start** (integer) - Required - The start timestamp for the query. - **end** (integer) - Required - The end timestamp for the query. - **offset** (integer) - Optional - The starting offset for the results. - **line** (integer) - Optional - The number of items to return per page. ### Request Example ```java streamManager.queryStreamPubHistories(namespaceId, stream.getStreamID(), start, end, offset, line); ``` ### Response Not specified ``` -------------------------------- ### Update Template Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Updates an existing template using patch operations. ```APIDOC ## Update Template ### Description Updates an existing template using patch operations. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **templateId** (string) - Required - The ID of the template to update. #### Request Body - **patchOperation** (PatchOperation array) - Required - An array of patch operations to apply to the template. - **op** (string) - Required - The operation type (e.g., "replace"). - **path** (string) - Required - The path to the field to update. - **value** (any) - Required - The new value for the field. ### Request Example ```java PatchOperation[] patchOperation = {new PatchOperation("replace", "name", "testtemplate002")}; templateManager.updateTemplate(templateId, patchOperation); ``` ### Response Not specified ``` -------------------------------- ### Query Recording Histories Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Queries recording history records for a specific stream within a given time range. ```APIDOC ## Query Recording Histories ### Description Queries recording history records for a specific stream within a given time range. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace. - **streamId** (string) - Required - The ID of the stream. #### Query Parameters - **start** (integer) - Required - The start timestamp for the query. - **end** (integer) - Required - The end timestamp for the query. - **line** (integer) - Optional - The number of items to return per page. - **maker** (string) - Optional - Filter by maker. ### Request Example ```java int start = 1587975463; int end = 1587976463; String maker = ""; streamManager.queryStreamRecordHistories(namespaceId, stream.getStreamID(), start, end, line, maker); ``` ### Response Not specified ``` -------------------------------- ### Update Stream Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Updates an existing stream within a namespace. ```APIDOC ## Update Stream ### Description Updates an existing stream within a namespace. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace. - **streamId** (string) - Required - The ID of the stream to update. #### Request Body - **patchOperation** (PatchOperation array) - Required - An array of patch operations to apply to the stream. - **op** (string) - Required - The operation type (e.g., "replace"). - **path** (string) - Required - The path to the field to update. - **value** (any) - Required - The new value for the field. ### Request Example ```java PatchOperation[] patchOperation = {new PatchOperation("replace", "desc", "test")}; streamManager.updateStream(namespaceId, stream.getStreamID(), patchOperation); ``` ### Response Not specified ``` -------------------------------- ### Delete Namespace Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Deletes a specific namespace using its ID. ```Java // 删除空间 nameSpaceManager.deleteNameSpace(namespaceId); ``` -------------------------------- ### Delete Namespace Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Deletes a specified namespace using its ID. ```APIDOC ## Delete Namespace ### Description Deletes a specified namespace. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace to delete. ### Request Example ```java nameSpaceManager.deleteNameSpace(namespaceId); ``` ### Response Not specified ``` -------------------------------- ### Delete Device Access Key (DAK) Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/linking/README.md Remove a Device Access Key (DAK) from a device using deviceManager.deleteDeviceKey. ```java deviceManager.deleteDeviceKey(appid,deviceName,dak); ``` -------------------------------- ### Update Template Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Updates an existing template using patch operations. Allows modification of template properties like name. ```Java // 更新模板 PatchOperation[] patchOperation = {new PatchOperation("replace", "name","testtemplate002")}; templateManager.updateTemplate(templateId, patchOperation); ``` -------------------------------- ### Update Stream Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Updates an existing stream using patch operations. Allows modification of stream properties like description. ```Java // 更新流 PatchOperation[] patchOperation = {new PatchOperation("replace", "desc", "test")}; streamManager.updateStream(namespaceId, stream.getStreamID(), patchOperation); ``` -------------------------------- ### Stop Stream Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Stops a specified stream within a namespace. ```APIDOC ## Stop Stream ### Description Stops a specified stream within a namespace. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace. - **streamId** (string) - Required - The ID of the stream to stop. ### Request Example ```java streamManager.stopStream(namespaceId, stream.getStreamID()); ``` ### Response Not specified ``` -------------------------------- ### Stop Device Pull Stream Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Stops pulling streams from a specified device within a namespace. ```APIDOC ## Stop Device Pull Stream ### Description Stops pulling streams from a specified device within a namespace. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace. - **gbId** (string) - Required - The GB ID of the device. - **channelId** (string) - Required - The ID of the channel to stop pulling stream from. ### Request Example ```java deviceManager.stopDevice(namespaceId, device.getGbId(), "31011500991320000056"); ``` ### Response Not specified ``` -------------------------------- ### Stop Stream Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Stops a specific stream within a namespace. ```Java // 停用流 streamManager.stopStream(namespaceId, stream.getStreamID()); ``` -------------------------------- ### Stop Device Pull Stream Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Stops pulling streams from a specific device within a namespace using its GB ID. ```Java // 停止设备拉流 deviceManager.stopDevice(namespaceId, device.getGbId(), "31011500991320000056"); ``` -------------------------------- ### Delete Stream Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Deletes a specific stream from a namespace. ```Java // 删除流 streamManager.deleteStream(namespaceId, stream.getStreamID()); ``` -------------------------------- ### Disable Stream Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Disables a specified stream within a namespace. ```APIDOC ## Disable Stream ### Description Disables a specified stream within a namespace. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace. - **streamId** (string) - Required - The ID of the stream to disable. ### Request Example ```java streamManager.disableStream(namespaceId, stream.getStreamID()); ``` ### Response Not specified ``` -------------------------------- ### Delete Template Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Deletes a specified template using its ID. ```APIDOC ## Delete Template ### Description Deletes a specified template using its ID. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **templateId** (string) - Required - The ID of the template to delete. ### Request Example ```java templateManager.deleteTemplate(templateId); ``` ### Response Not specified ``` -------------------------------- ### Delete Template Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Deletes a specific template using its template ID. ```Java // 删除模板 templateManager.deleteTemplate(templateId); ``` -------------------------------- ### Delete Stream Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Deletes a specified stream within a namespace. ```APIDOC ## Delete Stream ### Description Deletes a specified stream within a namespace. ### Method Not specified (SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters - **namespaceId** (string) - Required - The ID of the namespace. - **streamId** (string) - Required - The ID of the stream to delete. ### Request Example ```java streamManager.deleteStream(namespaceId, stream.getStreamID()); ``` ### Response Not specified ``` -------------------------------- ### Disable Stream Source: https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/qvs/README.md Disables a specific stream within a namespace, preventing it from being used. ```Java // 禁用流 streamManager.disableStream(namespaceId, stream.getStreamID()); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.