# Transition a mutually exclusive study collection POST https://api.prolific.com/api/v1/study-collections/mutually-exclusive/{id}/transition/ Content-Type: application/json Transition a mutually exclusive study collection. This is used to: - Publish a study collection - Cancel publish a study collection - Schedule publish a study collection - This can be done by setting the publish_at on the study collection at create or patch, then transitioning with the "SCHEDULE_PUBLISH" action - Or optionally the publish_at can be provided directly in the body of the transition request Reference: https://beta-docs.prolific.com/api-reference/study-collections/transition-mutually-exclusive-study-collection ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Transition a mutually exclusive study collection version: endpoint_studyCollections.TransitionMutuallyExclusiveStudyCollection paths: /api/v1/study-collections/mutually-exclusive/{id}/transition/: post: operationId: transition-mutually-exclusive-study-collection summary: Transition a mutually exclusive study collection description: |- Transition a mutually exclusive study collection. This is used to: - Publish a study collection - Cancel publish a study collection - Schedule publish a study collection - This can be done by setting the publish_at on the study collection at create or patch, then transitioning with the "SCHEDULE_PUBLISH" action - Or optionally the publish_at can be provided directly in the body of the transition request 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: type: object properties: action: $ref: >- #/components/schemas/ApiV1StudyCollectionsMutuallyExclusiveIdTransitionPostRequestBodyContentApplicationJsonSchemaAction publish_at: type: string description: >- Optional parameter for scheduling publish, indicating the datetime and timezone the study collection should be scheduled to be published at components: schemas: ApiV1StudyCollectionsMutuallyExclusiveIdTransitionPostRequestBodyContentApplicationJsonSchemaAction: type: string enum: - value: PUBLISH - value: SCHEDULE_PUBLISH - value: CANCEL_PUBLISH 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 cancel_publish import requests url = "https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/" payload = { "action": "CANCEL_PUBLISH" } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript cancel_publish const url = 'https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"action":"CANCEL_PUBLISH"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go cancel_publish package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/" payload := strings.NewReader("{\n \"action\": \"CANCEL_PUBLISH\"\n}") req, _ := http.NewRequest("POST", 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 cancel_publish require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"action\": \"CANCEL_PUBLISH\"\n}" response = http.request(request) puts response.read_body ``` ```java cancel_publish HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"action\": \"CANCEL_PUBLISH\"\n}") .asString(); ``` ```php cancel_publish request('POST', 'https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/', [ 'body' => '{ "action": "CANCEL_PUBLISH" }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp cancel_publish var client = new RestClient("https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"action\": \"CANCEL_PUBLISH\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift cancel_publish import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = ["action": "CANCEL_PUBLISH"] 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/transition/")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" 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 schedule_publish_time_already_set_on_collection import requests url = "https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/" payload = { "action": "SCHEDULE_PUBLISH" } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript schedule_publish_time_already_set_on_collection const url = 'https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"action":"SCHEDULE_PUBLISH"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go schedule_publish_time_already_set_on_collection package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/" payload := strings.NewReader("{\n \"action\": \"SCHEDULE_PUBLISH\"\n}") req, _ := http.NewRequest("POST", 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 schedule_publish_time_already_set_on_collection require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"action\": \"SCHEDULE_PUBLISH\"\n}" response = http.request(request) puts response.read_body ``` ```java schedule_publish_time_already_set_on_collection HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"action\": \"SCHEDULE_PUBLISH\"\n}") .asString(); ``` ```php schedule_publish_time_already_set_on_collection request('POST', 'https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/', [ 'body' => '{ "action": "SCHEDULE_PUBLISH" }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp schedule_publish_time_already_set_on_collection var client = new RestClient("https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"action\": \"SCHEDULE_PUBLISH\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift schedule_publish_time_already_set_on_collection import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = ["action": "SCHEDULE_PUBLISH"] 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/transition/")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" 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 schedule_publish_time_set_in_request import requests url = "https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/" payload = { "action": "SCHEDULE_PUBLISH", "publish_at": "2050-02-28T13:45:00 Europe/London" } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript schedule_publish_time_set_in_request const url = 'https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"action":"SCHEDULE_PUBLISH","publish_at":"2050-02-28T13:45:00 Europe/London"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go schedule_publish_time_set_in_request package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/" payload := strings.NewReader("{\n \"action\": \"SCHEDULE_PUBLISH\",\n \"publish_at\": \"2050-02-28T13:45:00 Europe/London\"\n}") req, _ := http.NewRequest("POST", 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 schedule_publish_time_set_in_request require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"action\": \"SCHEDULE_PUBLISH\",\n \"publish_at\": \"2050-02-28T13:45:00 Europe/London\"\n}" response = http.request(request) puts response.read_body ``` ```java schedule_publish_time_set_in_request HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"action\": \"SCHEDULE_PUBLISH\",\n \"publish_at\": \"2050-02-28T13:45:00 Europe/London\"\n}") .asString(); ``` ```php schedule_publish_time_set_in_request request('POST', 'https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/', [ 'body' => '{ "action": "SCHEDULE_PUBLISH", "publish_at": "2050-02-28T13:45:00 Europe/London" }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp schedule_publish_time_set_in_request var client = new RestClient("https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"action\": \"SCHEDULE_PUBLISH\",\n \"publish_at\": \"2050-02-28T13:45:00 Europe/London\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift schedule_publish_time_set_in_request import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "action": "SCHEDULE_PUBLISH", "publish_at": "2050-02-28T13:45:00 Europe/London" ] 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/transition/")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" 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/transition/" payload = { "action": "PUBLISH" } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"action":"PUBLISH"}' }; 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/transition/" payload := strings.NewReader("{\n \"action\": \"PUBLISH\"\n}") req, _ := http.NewRequest("POST", 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/transition/") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"action\": \"PUBLISH\"\n}" response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"action\": \"PUBLISH\"\n}") .asString(); ``` ```php request('POST', 'https://api.prolific.com/api/v1/study-collections/mutually-exclusive/id/transition/', [ 'body' => '{ "action": "PUBLISH" }', '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/transition/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"action\": \"PUBLISH\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = ["action": "PUBLISH"] 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/transition/")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" 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() ```