# Update a mutually exclusive study collection PATCH https://api.prolific.com/api/v1/study-collections/mutually-exclusive/{id}/ Content-Type: application/json Update a mutually exclusive study collection Reference: https://beta-docs.prolific.com/api-reference/study-collections/update-mutually-exclusive-study-collection ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Update a mutually exclusive study collection version: endpoint_studyCollections.UpdateMutuallyExclusiveStudyCollection paths: /api/v1/study-collections/mutually-exclusive/{id}/: patch: operationId: update-mutually-exclusive-study-collection summary: Update a mutually exclusive study collection description: Update a mutually exclusive study collection tags: - - subpackage_studyCollections parameters: - name: id in: path required: true schema: type: string - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '200': description: Mutually exclusive study collection content: application/json: schema: $ref: '#/components/schemas/MutuallyExclusiveStudyCollectionDetail' '400': description: Error content: {} requestBody: content: application/json: schema: $ref: '#/components/schemas/MutuallyExclusiveStudyCollectionUpdate' components: schemas: MutuallyExclusiveStudyCollectionUpdate: type: object properties: name: type: string description: Mutually exclusive study collection name description: type: string description: A description of the study collection publish_at: type: - string - 'null' description: >- Datetime and timezone the study collection should be scheduled to be published at study_ids: type: array items: type: string description: >- List of study ids you wish to include in the collection. Note, this will overwrite the current list of studies in the collection MutuallyExclusiveStudyCollectionListStatus: type: string enum: - value: ACTIVE - value: PAUSED - value: UNPUBLISHED - value: PUBLISHING - value: AWAITING_REVIEW - value: SCHEDULED MutuallyExclusiveStudyCollectionDetail: type: object properties: name: type: string description: Mutually exclusive study collection name description: type: string description: A description of the study collection publish_at: type: - string - 'null' description: >- Datetime and timezone the study collection should be scheduled to be published at study_ids: type: array items: type: string description: >- List of study ids you wish to include in the collection. Note, this will overwrite the current list of studies in the collection id: type: string description: Mutually exclusive study collection id status: $ref: '#/components/schemas/MutuallyExclusiveStudyCollectionListStatus' description: Status of the study collection estimated_cost: type: - string - 'null' description: Estimated cost of the study collection total_cost: type: - string - 'null' description: Estimated cost of the study collection ``` ## SDK Code Examples ```python update_description import requests url = "https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/" payload = { "description": "This is a description of my mutually exclusive study collection" } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.patch(url, json=payload, headers=headers) print(response.json()) ``` ```javascript update_description const url = 'https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/'; const options = { method: 'PATCH', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"description":"This is a description of my mutually exclusive study collection"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go update_description package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/" payload := strings.NewReader("{\n \"description\": \"This is a description of my mutually exclusive study collection\"\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_description require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/study-collections/mutually-exclusive/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 \"description\": \"This is a description of my mutually exclusive study collection\"\n}" response = http.request(request) puts response.read_body ``` ```java update_description HttpResponse response = Unirest.patch("https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"description\": \"This is a description of my mutually exclusive study collection\"\n}") .asString(); ``` ```php update_description request('PATCH', 'https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/', [ 'body' => '{ "description": "This is a description of my mutually exclusive study collection" }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp update_description var client = new RestClient("https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/"); var request = new RestRequest(Method.PATCH); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"description\": \"This is a description of my mutually exclusive study collection\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift update_description import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = ["description": "This is a description of my mutually exclusive study collection"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/study-collections/mutually-exclusive/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_studies import requests url = "https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/" payload = { "study_ids": ["5f7b9a7b5f7b9a7b5f7b9a7b", "5f7b9a7b5f7b9a7b5f7b9a6b"] } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.patch(url, json=payload, headers=headers) print(response.json()) ``` ```javascript update_studies const url = 'https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/'; const options = { method: 'PATCH', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"study_ids":["5f7b9a7b5f7b9a7b5f7b9a7b","5f7b9a7b5f7b9a7b5f7b9a6b"]}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go update_studies package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/" payload := strings.NewReader("{\n \"study_ids\": [\n \"5f7b9a7b5f7b9a7b5f7b9a7b\",\n \"5f7b9a7b5f7b9a7b5f7b9a6b\"\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 update_studies require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/study-collections/mutually-exclusive/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 \"study_ids\": [\n \"5f7b9a7b5f7b9a7b5f7b9a7b\",\n \"5f7b9a7b5f7b9a7b5f7b9a6b\"\n ]\n}" response = http.request(request) puts response.read_body ``` ```java update_studies HttpResponse response = Unirest.patch("https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"study_ids\": [\n \"5f7b9a7b5f7b9a7b5f7b9a7b\",\n \"5f7b9a7b5f7b9a7b5f7b9a6b\"\n ]\n}") .asString(); ``` ```php update_studies request('PATCH', 'https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/', [ 'body' => '{ "study_ids": [ "5f7b9a7b5f7b9a7b5f7b9a7b", "5f7b9a7b5f7b9a7b5f7b9a6b" ] }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp update_studies var client = new RestClient("https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/"); var request = new RestRequest(Method.PATCH); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"study_ids\": [\n \"5f7b9a7b5f7b9a7b5f7b9a7b\",\n \"5f7b9a7b5f7b9a7b5f7b9a6b\"\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift update_studies import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = ["study_ids": ["5f7b9a7b5f7b9a7b5f7b9a7b", "5f7b9a7b5f7b9a7b5f7b9a6b"]] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/study-collections/mutually-exclusive/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 import requests url = "https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/" payload = { "name": "My Mutually Exclusive Study Collection" } 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/study-collections/mutually-exclusive/id/'; const options = { method: 'PATCH', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"name":"My Mutually Exclusive Study Collection"}' }; 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/study-collections/mutually-exclusive/id/" payload := strings.NewReader("{\n \"name\": \"My Mutually Exclusive Study Collection\"\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 require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/study-collections/mutually-exclusive/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\": \"My Mutually Exclusive Study Collection\"\n}" response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.patch("https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"name\": \"My Mutually Exclusive Study Collection\"\n}") .asString(); ``` ```php request('PATCH', 'https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/', [ 'body' => '{ "name": "My Mutually Exclusive Study Collection" }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/"); var request = new RestRequest(Method.PATCH); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"name\": \"My Mutually Exclusive Study Collection\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = ["name": "My Mutually Exclusive Study Collection"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/study-collections/mutually-exclusive/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() ```