Update concept
PATCH https://app.coactive.ai/api/v1/concepts/{concept_id}Content-Type: application/jsonUpdate concept
Authentication
Section titled “Authentication”Authorizationheader (bearer token, required) — Bearer authentication of the formBearer <token>, where token is your auth token.
Request
Section titled “Request”Path parameters
Section titled “Path parameters”concept_id(string, required) — The unique identifier for the concept
Body (application/json)
Section titled “Body (application/json)”This endpoint expects an object.
name(string, optional, nullable) — A replacement name for the conceptdescription(string, optional, nullable) — A replacement description for the conceptthreshold(double, optional, nullable) — A replacement decision threshold for the conceptregularization(double, optional, nullable) — How strongly the model adapts to the training labels. Regularization strength. Lower value means the model fits more heavily to the training data
Response
Section titled “Response”Concept details
createdUserId(string, required) — The user that created the resourcecreatedDt(string, required) — The created datetime of the resourceupdatedUserId(string, required) — The user that last updated the resourceupdatedDt(string, required) — The datetime the resource was last updatedname(string, required) — The name of the conceptconceptId(string, required) — The unique identifier for the conceptdatasetId(string, required) — The unique identifier for the datasetdescription(string, optional, nullable) — A description for the conceptthreshold(double, optional, nullable, default: 0.8) — Threshold above which classification is positiveregularization(double, optional, nullable, default: 0.0625) — How strongly the model adapts to the training labels. Regularization strength. Lower value means the model fits more heavily to the training data
Errors
Section titled “Errors”404 Not Found Error
Section titled “404 Not Found Error”Not found
detail(string, required) — Details about the encountered error
422 Unprocessable Entity Error
Section titled “422 Unprocessable Entity Error”Validation Error
detail(list of object, optional)loc(list of string or integer or string or integer, required)msg(string, required)type(string, required)
Examples
Section titled “Examples”Request
{ "name": "TheNorth", "description": "Screenshots and clips from Game of Thrones that take place in the North", "threshold": 0.8, "regularization": 0.0625}Response
{ "createdUserId": "user_example", "createdDt": "2018-09-11T15:11:45.456Z", "updatedUserId": "user_example", "updatedDt": "2018-09-11T15:11:45.456Z", "name": "TheNorth", "conceptId": "428e52cd-7ceb-490c-ae3f-0848c82d8c97", "datasetId": "c40276f0-024b-4a3f-b3e6-dcf0d304843e", "description": "Screenshots and clips from Game of Thrones that take place in the North", "threshold": 0.8, "regularization": 0.0625, "created_user_id": "user_example", "created_dt": "2018-09-11T15:11:45.456Z", "updated_user_id": "user_example", "updated_dt": "2018-09-11T15:11:45.456Z", "concept_id": "428e52cd-7ceb-490c-ae3f-0848c82d8c97", "dataset_id": "c40276f0-024b-4a3f-b3e6-dcf0d304843e"}SDK Code
import requests
url = "https://app.coactive.ai/api/v1/concepts/428e52cd-7ceb-490c-ae3f-0848c82d8c97"
payload = { "name": "TheNorth", "description": "Screenshots and clips from Game of Thrones that take place in the North", "threshold": 0.8, "regularization": 0.0625}headers = { "Authorization": "Bearer <token>", "Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())const url = 'https://app.coactive.ai/api/v1/concepts/428e52cd-7ceb-490c-ae3f-0848c82d8c97';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"TheNorth","description":"Screenshots and clips from Game of Thrones that take place in the North","threshold":0.8,"regularization":0.0625}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://app.coactive.ai/api/v1/concepts/428e52cd-7ceb-490c-ae3f-0848c82d8c97"
payload := strings.NewReader("{\n \"name\": \"TheNorth\",\n \"description\": \"Screenshots and clips from Game of Thrones that take place in the North\",\n \"threshold\": 0.8,\n \"regularization\": 0.0625\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>") req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}require 'uri'require 'net/http'
url = URI("https://app.coactive.ai/api/v1/concepts/428e52cd-7ceb-490c-ae3f-0848c82d8c97")
http = Net::HTTP.new(url.host, url.port)http.use_ssl = true
request = Net::HTTP::Patch.new(url)request["Authorization"] = 'Bearer <token>'request["Content-Type"] = 'application/json'request.body = "{\n \"name\": \"TheNorth\",\n \"description\": \"Screenshots and clips from Game of Thrones that take place in the North\",\n \"threshold\": 0.8,\n \"regularization\": 0.0625\n}"
response = http.request(request)puts response.read_bodyimport com.mashape.unirest.http.HttpResponse;import com.mashape.unirest.http.Unirest;
HttpResponse<String> response = Unirest.patch("https://app.coactive.ai/api/v1/concepts/428e52cd-7ceb-490c-ae3f-0848c82d8c97") .header("Authorization", "Bearer <token>") .header("Content-Type", "application/json") .body("{\n \"name\": \"TheNorth\",\n \"description\": \"Screenshots and clips from Game of Thrones that take place in the North\",\n \"threshold\": 0.8,\n \"regularization\": 0.0625\n}") .asString();<?phprequire_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('PATCH', 'https://app.coactive.ai/api/v1/concepts/428e52cd-7ceb-490c-ae3f-0848c82d8c97', [ 'body' => '{ "name": "TheNorth", "description": "Screenshots and clips from Game of Thrones that take place in the North", "threshold": 0.8, "regularization": 0.0625}', 'headers' => [ 'Authorization' => 'Bearer <token>', 'Content-Type' => 'application/json', ],]);
echo $response->getBody();using RestSharp;
var client = new RestClient("https://app.coactive.ai/api/v1/concepts/428e52cd-7ceb-490c-ae3f-0848c82d8c97");var request = new RestRequest(Method.PATCH);request.AddHeader("Authorization", "Bearer <token>");request.AddHeader("Content-Type", "application/json");request.AddParameter("application/json", "{\n \"name\": \"TheNorth\",\n \"description\": \"Screenshots and clips from Game of Thrones that take place in the North\",\n \"threshold\": 0.8,\n \"regularization\": 0.0625\n}", ParameterType.RequestBody);IRestResponse response = client.Execute(request);import Foundation
let headers = [ "Authorization": "Bearer <token>", "Content-Type": "application/json"]let parameters = [ "name": "TheNorth", "description": "Screenshots and clips from Game of Thrones that take place in the North", "threshold": 0.8, "regularization": 0.0625] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "https://app.coactive.ai/api/v1/concepts/428e52cd-7ceb-490c-ae3f-0848c82d8c97")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0)request.httpMethod = "PATCH"request.allHTTPHeaderFields = headersrequest.httpBody = postData as Data
let session = URLSession.sharedlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) }})
dataTask.resume()