Delete training files
Delete training files by document class based on file ID.
Syntax.
DELETE /model/documentClass/{documentClassId}/files| Property | Data type | Description |
|---|---|---|
| apiKey header | String | Required. Header to authenticate the API call. |
| documentClassId path | Integer | Required. A unique identifier for each document class. documentClassId
can be retrieved with Get /model/documentClass. |
| files body | Array | Optional. If file IDs are provided, only specific files are deleted from that document class.
Otherwise, all files in that document class are deleted. File IDs are retrieved with the function
GET /model/documentClass/{documentClassId}/files. |
- Curl
-
curl -X DELETE -u 'Functional ID:Password' 'https://requesturl/ca/rest/content/v1/model/documentClass/{documentClassId}/files' -H 'apiKey: ZjMzYzg1ZDYtNTk1Nwhi5782NzItYjg3Mzg2ZGQwOGNhO3h5aWJtO2RlZmF1bHQ=' -H 'Content-Type: application/json' -d '{ "files": [ 21, 2, 12, 3 ]}' - Java
-
import java.io.IOException; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; import okhttp3.RequestBody; import java.util.Base64; import okhttp3.MediaType; public class testcode { public static void main(String[] args) { String encoding = Base64.getEncoder().encodeToString(("Functional ID:Password").getBytes()); OkHttpClient client = new OkHttpClient(); MediaType mediaType = MediaType.parse("application/json;"); RequestBody body = RequestBody.create(mediaType, "{'files': [ 21,2,12,3]}"); Request request = new Request.Builder() .url("https://requesturl/ca/rest/content/v1/model/documentClass/{documentClassId}/files") .delete(body) .addHeader("apiKey", "ZjMzYzg1ZDYtNTk1Nwhi5782NzItYjg3Mzg2ZGQwOGNhO3h5aWJtO2RlZmF1bHQ=") .addHeader("Authorization", "Basic " + encoding) .build(); try { Response response = client.newCall(request).execute(); System.out.println(response.body().string()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } /* * The JAR files in Referenced Libraries could be found in the Download section with the following link: * 1. okhttp.jar - https://github.com/square/okhttp * 2. okio.jar - https://github.com/square/okio */ - JavaScript
-
var request = require("request"); var Base64 = require('js-base64').Base64; var encoding = Base64.encode('Functional ID:Password'); var options = { method: 'DELETE', url: 'https://requesturl/ca/rest/content/v1/model/documentClass/{documentClassId}/files', headers: { 'apiKey' : 'ZjMzYzg1ZDYtNTk1Nwhi5782NzItYjg3Mzg2ZGQwOGNhO3h5aWJtO2RlZmF1bHQ=', 'authorization': "Basic " + encoding }, body: { "files": [21,2,12,3] } }; request(options, function (error, response, body) { console.log(body) if (error) throw new Error(error); }); - Python
-
import requests import base64 encoding = base64.b64encode(b'Functional ID:Password') url = "https://requesturl/ca/rest/content/v1/model/documentClass/{documentClassId}/files" headers = { "apiKey" : "ZjMzYzg1ZDYtNTk1Nwhi5782NzItYjg3Mzg2ZGQwOGNhO3h5aWJtO2RlZmF1bHQ=", "authorization": "Basic " + encoding.decode("utf-8") } data= { "files": [21,2,12,3] } response = requests.request("DELETE", url, headers=headers, data=data)