# Update a Batch PATCH https://api.prolific.com/api/v1/data-collection/batches/{batch_id} Content-Type: application/json Update an existing AI Task Builder batch. You can update the name, task details, and/or associated dataset. The dataset does not need to be in READY status for updates. Reference: https://beta-docs.prolific.com/api-reference/ai-task-builder/update-task-builder-batch ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Update a Batch version: endpoint_aiTaskBuilder.UpdateTaskBuilderBatch paths: /api/v1/data-collection/batches/{batch_id}: patch: operationId: update-task-builder-batch summary: Update a Batch description: >- Update an existing AI Task Builder batch. You can update the name, task details, and/or associated dataset. The dataset does not need to be in READY status for updates. tags: - - subpackage_aiTaskBuilder parameters: - name: batch_id in: path description: The unique identifier of the batch required: true schema: type: string - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '200': description: Ok content: application/json: schema: $ref: '#/components/schemas/AITaskBuilderBatch' '400': description: Error content: {} requestBody: content: application/json: schema: type: object properties: name: type: string task_details: $ref: >- #/components/schemas/ApiV1DataCollectionBatchesBatchIdPatchRequestBodyContentApplicationJsonSchemaTaskDetails dataset_id: type: string format: uuid components: schemas: ApiV1DataCollectionBatchesBatchIdPatchRequestBodyContentApplicationJsonSchemaTaskDetails: type: object properties: task_name: type: string task_introduction: type: string description: HTML formatted task introduction task_steps: type: string description: HTML formatted task steps required: - task_name - task_introduction - task_steps AiTaskBuilderBatchDatasetsItems: type: object properties: id: type: string format: uuid total_datapoint_count: type: integer filename: type: string description: The filename of the dataset required: - id - total_datapoint_count - filename AiTaskBuilderBatchStatus: type: string enum: - value: UNINITIALISED - value: PROCESSING - value: READY - value: ERROR AiTaskBuilderBatchTaskDetails: type: object properties: task_name: type: string task_introduction: type: string description: HTML formatted task introduction task_steps: type: string description: HTML formatted task steps required: - task_name - task_introduction - task_steps AITaskBuilderBatch: type: object properties: id: type: string format: uuid created_at: type: string format: date-time description: >- An ISO-8601 formatted string representing the batch creation time, in UTC. created_by: type: string description: User ID of the Prolific user that created the resource. datasets: type: array items: $ref: '#/components/schemas/AiTaskBuilderBatchDatasetsItems' name: type: string status: $ref: '#/components/schemas/AiTaskBuilderBatchStatus' total_task_count: type: integer total_instruction_count: type: integer workspace_id: type: string schema_version: type: integer task_details: $ref: '#/components/schemas/AiTaskBuilderBatchTaskDetails' total_task_groups: type: integer required: - id - created_at - created_by - datasets - name - status - total_task_count - total_instruction_count - workspace_id - schema_version - task_details - total_task_groups ``` ## SDK Code Examples ```python import requests url = "https://api.prolific.com/api/v1/data-collection/batches/batch_id" payload = {} headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.patch(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.prolific.com/api/v1/data-collection/batches/batch_id'; const options = { method: 'PATCH', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/data-collection/batches/batch_id" payload := strings.NewReader("{}") req, _ := http.NewRequest("PATCH", url, payload) req.Header.Add("Authorization", "") 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)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/data-collection/batches/batch_id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Patch.new(url) request["Authorization"] = '' request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.patch("https://api.prolific.com/api/v1/data-collection/batches/batch_id") .header("Authorization", "") .header("Content-Type", "application/json") .body("{}") .asString(); ``` ```php request('PATCH', 'https://api.prolific.com/api/v1/data-collection/batches/batch_id', [ 'body' => '{}', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.prolific.com/api/v1/data-collection/batches/batch_id"); var request = new RestRequest(Method.PATCH); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/data-collection/batches/batch_id")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "PATCH" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let 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() ```