# Update a participant group PATCH https://api.prolific.com/api/v1/participant-groups/{id}/ Content-Type: application/json Reference: https://beta-docs.prolific.com/api-reference/participant-groups/update-participant-group ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Update a participant group version: endpoint_participantGroups.UpdateParticipantGroup paths: /api/v1/participant-groups/{id}/: patch: operationId: update-participant-group summary: Update a participant group tags: - - subpackage_participantGroups parameters: - name: id in: path description: The id of the participant group required: true schema: type: string - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '200': description: Request successful. content: application/json: schema: $ref: '#/components/schemas/ParticipantGroupResponse' '400': description: Error content: {} requestBody: content: application/json: schema: $ref: '#/components/schemas/ParticipantGroupUpdate' components: schemas: ParticipantGroupUpdate: type: object properties: name: type: string description: The name of the participant group participant_ids: type: array items: type: string description: >- The ids of participants to be included in the group. Note, this overwrites any existing participants in the group; use the participant group membership endpoints to [append](#tag/Participant-Groups/operation/AddToParticipantGroup) or [remove](#tag/Participant-Groups/operation/RemoveFromParticipantGroup) participants from the group. ParticipantGroupFeederStudiesItemsFeederCompletionCodesItemsAction: type: string enum: - value: ADD_TO_PARTICIPANT_GROUP - value: REMOVE_FROM_PARTICIPANT_GROUP ParticipantGroupFeederStudiesItemsFeederCompletionCodesItems: type: object properties: code: type: string description: The code that will modify the participants in this group. code_type: type: string description: >- The label or code type given to this code within the context of the study. action: $ref: >- #/components/schemas/ParticipantGroupFeederStudiesItemsFeederCompletionCodesItemsAction description: The action that will be taken when this code is used. ParticipantGroupFeederStudiesItems: type: object properties: id: type: string description: The id of the study. name: type: string description: The name of the study. internal_name: type: string description: The internal name of the study. status: type: string description: The current status of the study. feeder_completion_codes: type: array items: $ref: >- #/components/schemas/ParticipantGroupFeederStudiesItemsFeederCompletionCodesItems description: >- The completion codes which will modify the participants in this group. ParticipantGroupResponse: type: object properties: id: type: string description: The id of the participant group name: type: string description: The name of the participant group project_id: type: - string - 'null' description: The id of the project the participant group belongs to workspace_id: type: - string - 'null' description: >- The id of the workspace the participant group belongs to. A participant group can only belong to either a workspace or an organisation. organisation_id: type: - string - 'null' description: >- The id of the organisation the participant group belongs to. A participant group can only belong to either a workspace or an organisation. description: type: - string - 'null' description: The user-provided description of the participant group participant_count: type: integer description: The number of participants in the participant group is_deleted: type: boolean description: Whether the participant group has been deleted feeder_studies: type: array items: $ref: '#/components/schemas/ParticipantGroupFeederStudiesItems' description: >- Details of all studies which are configured to modify the participants in this group through completion codes. ``` ## SDK Code Examples ```python Participant Groups_UpdateParticipantGroup_example import requests url = "https://api.prolific.com/api/v1/participant-groups/id/" headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.patch(url, headers=headers) print(response.json()) ``` ```javascript Participant Groups_UpdateParticipantGroup_example const url = 'https://api.prolific.com/api/v1/participant-groups/id/'; const options = { method: 'PATCH', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: undefined }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Participant Groups_UpdateParticipantGroup_example package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/participant-groups/id/" req, _ := http.NewRequest("PATCH", url, nil) 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 Participant Groups_UpdateParticipantGroup_example require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/participant-groups/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' response = http.request(request) puts response.read_body ``` ```java Participant Groups_UpdateParticipantGroup_example HttpResponse response = Unirest.patch("https://api.prolific.com/api/v1/participant-groups/id/") .header("Authorization", "") .header("Content-Type", "application/json") .asString(); ``` ```php Participant Groups_UpdateParticipantGroup_example request('PATCH', 'https://api.prolific.com/api/v1/participant-groups/id/', [ 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Participant Groups_UpdateParticipantGroup_example var client = new RestClient("https://api.prolific.com/api/v1/participant-groups/id/"); var request = new RestRequest(Method.PATCH); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); IRestResponse response = client.Execute(request); ``` ```swift Participant Groups_UpdateParticipantGroup_example import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/participant-groups/id/")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "PATCH" request.allHTTPHeaderFields = headers 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() ``` ```python update_participant_group_name import requests url = "https://api.prolific.com/api/v1/participant-groups/id/" payload = { "name": "Passed all attention checks" } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.patch(url, json=payload, headers=headers) print(response.json()) ``` ```javascript update_participant_group_name const url = 'https://api.prolific.com/api/v1/participant-groups/id/'; const options = { method: 'PATCH', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"name":"Passed all attention checks"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go update_participant_group_name package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/participant-groups/id/" payload := strings.NewReader("{\n \"name\": \"Passed all attention checks\"\n}") 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 update_participant_group_name require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/participant-groups/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 = "{\n \"name\": \"Passed all attention checks\"\n}" response = http.request(request) puts response.read_body ``` ```java update_participant_group_name HttpResponse response = Unirest.patch("https://api.prolific.com/api/v1/participant-groups/id/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"name\": \"Passed all attention checks\"\n}") .asString(); ``` ```php update_participant_group_name request('PATCH', 'https://api.prolific.com/api/v1/participant-groups/id/', [ 'body' => '{ "name": "Passed all attention checks" }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp update_participant_group_name var client = new RestClient("https://api.prolific.com/api/v1/participant-groups/id/"); var request = new RestRequest(Method.PATCH); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"name\": \"Passed all attention checks\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift update_participant_group_name import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = ["name": "Passed all attention checks"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/participant-groups/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() ``` ```python update_participant_group_description import requests url = "https://api.prolific.com/api/v1/participant-groups/id/" payload = {} headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.patch(url, json=payload, headers=headers) print(response.json()) ``` ```javascript update_participant_group_description const url = 'https://api.prolific.com/api/v1/participant-groups/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 update_participant_group_description package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/participant-groups/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 update_participant_group_description require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/participant-groups/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 update_participant_group_description HttpResponse response = Unirest.patch("https://api.prolific.com/api/v1/participant-groups/id/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{}") .asString(); ``` ```php update_participant_group_description request('PATCH', 'https://api.prolific.com/api/v1/participant-groups/id/', [ 'body' => '{}', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp update_participant_group_description var client = new RestClient("https://api.prolific.com/api/v1/participant-groups/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 update_participant_group_description 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/participant-groups/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() ``` ```python overwrite_participant_group_participants import requests url = "https://api.prolific.com/api/v1/participant-groups/id/" payload = { "participant_ids": ["5e9b9c9b0f9c9a0001b0b1f4", "5e9b9c9b0f9c9a0001b0b1f5", "5e9b9c9b0f9c9a0001b0b1f6"] } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.patch(url, json=payload, headers=headers) print(response.json()) ``` ```javascript overwrite_participant_group_participants const url = 'https://api.prolific.com/api/v1/participant-groups/id/'; const options = { method: 'PATCH', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"participant_ids":["5e9b9c9b0f9c9a0001b0b1f4","5e9b9c9b0f9c9a0001b0b1f5","5e9b9c9b0f9c9a0001b0b1f6"]}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go overwrite_participant_group_participants package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/participant-groups/id/" payload := strings.NewReader("{\n \"participant_ids\": [\n \"5e9b9c9b0f9c9a0001b0b1f4\",\n \"5e9b9c9b0f9c9a0001b0b1f5\",\n \"5e9b9c9b0f9c9a0001b0b1f6\"\n ]\n}") 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 overwrite_participant_group_participants require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/participant-groups/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 = "{\n \"participant_ids\": [\n \"5e9b9c9b0f9c9a0001b0b1f4\",\n \"5e9b9c9b0f9c9a0001b0b1f5\",\n \"5e9b9c9b0f9c9a0001b0b1f6\"\n ]\n}" response = http.request(request) puts response.read_body ``` ```java overwrite_participant_group_participants HttpResponse response = Unirest.patch("https://api.prolific.com/api/v1/participant-groups/id/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"participant_ids\": [\n \"5e9b9c9b0f9c9a0001b0b1f4\",\n \"5e9b9c9b0f9c9a0001b0b1f5\",\n \"5e9b9c9b0f9c9a0001b0b1f6\"\n ]\n}") .asString(); ``` ```php overwrite_participant_group_participants request('PATCH', 'https://api.prolific.com/api/v1/participant-groups/id/', [ 'body' => '{ "participant_ids": [ "5e9b9c9b0f9c9a0001b0b1f4", "5e9b9c9b0f9c9a0001b0b1f5", "5e9b9c9b0f9c9a0001b0b1f6" ] }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp overwrite_participant_group_participants var client = new RestClient("https://api.prolific.com/api/v1/participant-groups/id/"); var request = new RestRequest(Method.PATCH); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"participant_ids\": [\n \"5e9b9c9b0f9c9a0001b0b1f4\",\n \"5e9b9c9b0f9c9a0001b0b1f5\",\n \"5e9b9c9b0f9c9a0001b0b1f6\"\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift overwrite_participant_group_participants import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = ["participant_ids": ["5e9b9c9b0f9c9a0001b0b1f4", "5e9b9c9b0f9c9a0001b0b1f5", "5e9b9c9b0f9c9a0001b0b1f6"]] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/participant-groups/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() ```