# Create a draft study POST https://api.prolific.com/api/v1/studies/ Content-Type: application/json Create a draft study. Publishing a study is a two step process, first create a draft study then publish it. ## Taskflow Studies: Taskflow studies are created in the same manner as regular studies, however instead of providing an **external_study_url**, you should provide an access_details array with **access_detail** objects instead, containing an external_url field and a total_allocation field. Reference: https://beta-docs.prolific.com/api-reference/studies/create-study ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Create a draft study version: endpoint_studies.CreateStudy paths: /api/v1/studies/: post: operationId: create-study summary: Create a draft study description: >- Create a draft study. Publishing a study is a two step process, first create a draft study then publish it. ## Taskflow Studies: Taskflow studies are created in the same manner as regular studies, however instead of providing an **external_study_url**, you should provide an access_details array with **access_detail** objects instead, containing an external_url field and a total_allocation field. tags: - - subpackage_studies parameters: - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/Study' '400': description: Error content: {} requestBody: content: application/json: schema: $ref: '#/components/schemas/CreateStudy' components: schemas: BaseStudyProlificIdOption: type: string enum: - value: question - value: url_parameters - value: not_required BaseStudyCompletionCodesItemsCodeType: type: string enum: - value: COMPLETED - value: FAILED_ATTENTION_CHECK - value: FOLLOW_UP_STUDY - value: GIVE_BONUS - value: INCOMPATIBLE_DEVICE - value: NO_CONSENT - value: OTHER - value: FIXED_SCREENOUT AutomaticallyApproveAction: type: string enum: - value: AUTOMATICALLY_APPROVE AutomaticallyApprove: type: object properties: action: $ref: '#/components/schemas/AutomaticallyApproveAction' description: >- Automatically approves submission with payment being processed immediately required: - action AddToParticipantGroupAction: type: string enum: - value: ADD_TO_PARTICIPANT_GROUP AddToParticipantGroup: type: object properties: action: $ref: '#/components/schemas/AddToParticipantGroupAction' description: Adds participants to a specific group participant_group: type: string description: The participant group to add the participant to. required: - action - participant_group RemoveFromParticipantGroupAction: type: string enum: - value: REMOVE_FROM_PARTICIPANT_GROUP RemoveFromParticipantGroup: type: object properties: action: $ref: '#/components/schemas/RemoveFromParticipantGroupAction' description: Removes participants from specific groups participant_group: type: string description: The participant group to remove the participant from. required: - action - participant_group ManuallyReviewAction: type: string enum: - value: MANUALLY_REVIEW ManuallyReview: type: object properties: action: $ref: '#/components/schemas/ManuallyReviewAction' description: Moves submission for the data collector to be manually reviewed. required: - action RequestReturnAction: type: string enum: - value: REQUEST_RETURN RequestReturn: type: object properties: action: $ref: '#/components/schemas/RequestReturnAction' description: Requests the participant to return their study return_reason: type: string description: The reason you would like to request a return required: - action - return_reason DynamicPaymentAction: type: string enum: - value: DYNAMIC_PAYMENT DynamicPayment: type: object properties: action: $ref: '#/components/schemas/DynamicPaymentAction' description: >- Use this action to set up a dynamic payment study. Only certain workspaces have access to this feature. When using this action, the actor must be "researcher". required: - action FixedScreenOutAction: type: string enum: - value: FIXED_SCREEN_OUT_PAYMENT FixedScreenOut: type: object properties: action: $ref: '#/components/schemas/FixedScreenOutAction' description: >- Use this action to set up a fixed screen out reward study. This feature is currently available to select workspaces only. - A fixed screen out reward study compensates participants with a predetermined amount when they do not qualify for the study. - This feature enables researchers to implement more precise participant screening while ensuring fair compensation for participants' time. fixed_screen_out_reward: type: integer description: >- The amount that you would like to pay for a screen-out submission (in subcurrency). This must be less that the study reward. slots: type: integer description: >- The slots field controls how many participants can be screened out of your study before it automatically pauses. #### What are slots? - Slots set a limit on screen-outs to help you budget upfront, by setting the limit to the maximum number of screen-outs you're comfortable paying for in your study. - When participants don't qualify for your study, they will receive a screen-out payment. - The slots limit prevents unexpected high costs created from too many screen-outs. - **Example**: If you set `slots: 50`, your study will pause after 50 participants are screened out, even if you still need more qualified participants. #### How slots work 1. **Participants are screened out** - When they enter the completion code linked to this action. They will automatically receive the fixed screen out reward. 2. **Study pauses automatically** - When the number of participants screened out reaches the slots limit, and there are still unfilled places in the study, the study will automatically pause. 3. **You get notified** - Via email and webhook, notifying you that you’ve reached your slot limit, and that your study has been paused. (Webhook notifications only if they’re enabled for `study.status.change` events) #### Resuming your study *To continue recruiting after hitting the slot limit:* 1. **Increase the slot limit** using the [update study](#tag/Studies/operation/UpdateStudy) endpoint. - Update the initial property to your new slot limit. - Refer `update_slots` in the example of the [UpdateStudy](#tag/Studies/operation/UpdateStudy) endpoint. - For example, if you started with 50 slots and want to add another 50 slots, set the `slots` property to 100. ```json { "completion_codes": [ { "code": "ABC123", "actions": [ { "action": "FIXED_SCREEN_OUT_PAYMENT", "slots": 100 } ] } ] } ``` 2. **Resume the study** by transitioning it back to `START` state using the [transition study](#tag/Studies/operation/PublishStudy) endpoint. ```json { "action": "START" } ``` required: - action - fixed_screen_out_reward - slots BaseStudyCompletionCodesItemsActionsItems: oneOf: - $ref: '#/components/schemas/AutomaticallyApprove' - $ref: '#/components/schemas/AddToParticipantGroup' - $ref: '#/components/schemas/RemoveFromParticipantGroup' - $ref: '#/components/schemas/ManuallyReview' - $ref: '#/components/schemas/RequestReturn' - $ref: '#/components/schemas/DynamicPayment' - $ref: '#/components/schemas/FixedScreenOut' BaseStudyCompletionCodesItemsActor: type: string enum: - value: participant - value: researcher default: participant BaseStudyCompletionCodesItems: type: object properties: code: type: - string - 'null' description: > The code the participant will either enter manually at the end of your study or be redirected as part of the return URL. If the code is null, then the participant will not be asked to submit a completion code when they return to Prolific. Null codes can only be provided when: - The actor is "participant" - There are no other completion codes with the "participant" actor - The actions array is empty The code must be unique within the study. code_type: $ref: '#/components/schemas/BaseStudyCompletionCodesItemsCodeType' description: > A name for your code to make it easier to understand its intention. Either use one of the predefined options or any other free text. actions: type: array items: $ref: '#/components/schemas/BaseStudyCompletionCodesItemsActionsItems' description: >- The actions that will be completed automatically when the submission is completed with this code by the participant. You have the ability to use one or multiple `actions` together - it's up to you and your desired automated journey. If you’re looking to keep things simple, we recommend setting the `{"action": "MANUALLY_REVIEW"}` option only, so all submissions wait for your manual approval. actor: $ref: '#/components/schemas/BaseStudyCompletionCodesItemsActor' description: The actor that can provide this completion code. required: - code - code_type - actions BaseStudyDeviceCompatibilityItems: type: string enum: - value: desktop - value: tablet - value: mobile BaseStudyPeripheralRequirementsItems: type: string enum: - value: audio - value: camera - value: download - value: microphone SelectFilter: type: object properties: filter_id: type: string description: ID of the "select" type filter. selected_values: type: array items: type: string description: >- This schema applies for filters of the `select` type, as defined in the [filter list response](\#tag/Filters/paths/~1api~1v1~1filters~1/get). Array of IDs matching the response IDs, from the `select` filter's `choices` (see response linked above). String format should match the `data_type` of the `select` filter's `choices` (see response linked above). weightings: type: object additionalProperties: type: number format: double description: >- Ratios to control the distribution of participants across the selected values. Integer percentages, floats, and exact quantities are valid inputs. required: - filter_id - selected_values RangeFilterSelectedRangeLower: oneOf: - type: integer - type: string - type: number format: double RangeFilterSelectedRangeUpper: oneOf: - type: integer - type: string - type: number format: double RangeFilterSelectedRange: type: object properties: lower: $ref: '#/components/schemas/RangeFilterSelectedRangeLower' description: Your selected lower bound for the range. upper: $ref: '#/components/schemas/RangeFilterSelectedRangeUpper' description: Your selected upper bound for the range. RangeFilterWeightingsSelectedRangeLower: oneOf: - type: integer - type: string - type: number format: double RangeFilterWeightingsSelectedRangeUpper: oneOf: - type: integer - type: string - type: number format: double RangeFilterWeightingsSelectedRange: type: object properties: lower: $ref: '#/components/schemas/RangeFilterWeightingsSelectedRangeLower' upper: $ref: '#/components/schemas/RangeFilterWeightingsSelectedRangeUpper' RangeFilterWeightings: type: object properties: selected_range: $ref: '#/components/schemas/RangeFilterWeightingsSelectedRange' weighting: type: number format: double required: - selected_range - weighting RangeFilter: type: object properties: filter_id: type: string description: ID of the "range" type filter. selected_range: $ref: '#/components/schemas/RangeFilterSelectedRange' description: >- This schema applies for filters of the `range` type, as defined in the [filter list response](\#tag/Filters/paths/~1api~1v1~1filters~1/get). A dictionary with two possible objects, 'lower' and 'upper'. At least one must be present and a non-null value. The expected data type for these values is defined by the `range` filter's `data_type` (see response linked above). If the data_type is a date, string format should be a parseable ISO8601 date string. Date values should be provided as a string in ISO 8601 format. Leaving a value as null will result in that bound being set to the lowest or highest possible value, depending on whether it is the upper or lower bound. weightings: $ref: '#/components/schemas/RangeFilterWeightings' description: >- Ratios to control the distribution of participants across the selected values. Integers and exact quantities are valid inputs. required: - filter_id - selected_range BaseStudyFiltersItems: oneOf: - $ref: '#/components/schemas/SelectFilter' - $ref: '#/components/schemas/RangeFilter' BaseStudySubmissionsConfigAutoRejectionCategoriesItems: type: string enum: - value: EXCEPTIONALLY_FAST BaseStudySubmissionsConfig: type: object properties: max_submissions_per_participant: type: - integer - 'null' default: 1 description: >- - **1** is the default Prolific experience. This means one submission, per participant, per study. If you do not specify this field, the **default is 1**. - **1+** turns your study into a multi-submission study, meaning a participant can create many submissions per study. As noted above, your survey system will need to handle providing a unique experience each time the participant takes the study. - **-1** will allow an indefinite number of submissions from a single participant, up to `total_available_places`. max_concurrent_submissions: type: - integer - 'null' default: -1 description: >- - **-1** is the default value, meaning unlimited concurrent active/reserved submissions per study. - **1+** limits the number of concurrent active/reserved submissions a study can have at one time. auto_rejection_categories: type: array items: $ref: >- #/components/schemas/BaseStudySubmissionsConfigAutoRejectionCategoriesItems description: >- List of rejection categories that trigger automatic submission rejections. **Available Categories:** - **EXCEPTIONALLY_FAST**: Automatically reject submissions completed in an exceptionally short time **Important Notes:** - **This feature is currently in an evaluation period and can be activated for your workspace upon request.** - Auto-rejections only apply to submissions in "AWAITING REVIEW" status - Submissions with return requests will not be auto-rejected - Auto-rejected submissions do not count towards your rejection limit - Set to an empty array `[]` or omit this field to disable auto-rejection BaseStudyStudyLabelsItems: type: string enum: - value: survey - value: writing_task - value: annotation - value: decision_making_task - value: interview - value: other - value: ai_annotation - value: ai_evaluation - value: ai_reasoning - value: ai_fact_checking - value: ai_safety - value: ai_data_creation_text - value: ai_data_creation_audio - value: ai_data_creation_video - value: ai_data_creation_images - value: ai_other BaseStudyContentWarningsItems: type: string enum: - value: sensitive - value: explicit BaseStudyDataCollectionMethod: type: string enum: - value: DC_TOOL - value: AI_TASK_BUILDER BaseStudyDataCollectionMetadata: type: object properties: annotators_per_task: type: integer description: >- Number of annotators required per task. Required for AI Task Builder studies to set multiple annotators. AccessDetail: type: object properties: external_url: type: string description: >- URL of the task you want to send the participant to. You can pass URL search parameters as in `external_study_url`. total_allocation: type: number format: double description: The number of places you want to be sent to this URL for taskflow. required: - external_url - total_allocation BaseStudyAccessDetailsItems: oneOf: - $ref: '#/components/schemas/AccessDetail' CreateStudy: type: object properties: name: type: string description: Public name or title of the study internal_name: type: - string - 'null' description: Internal name of the study, not shown to participants description: type: string description: >- Description of the study for the participants to read before starting the study **Supported HTML in `description`** The `description` field supports the following HTML tags for formatting participant instructions: * `` - bold * `` - italic * `` - emphasized text * `` - strong importance * `` - strikethrough * `` - underline * `

` - heading level 1 * `

` - heading level 2 * `
    ` - ordered list * `
      ` - unordered list * `
    • ` - list item * `

      ` - paragraph Other HTML tags will be stripped or escaped. Please ensure that you only use supported tags for formatting to avoid rendering issues. external_study_url: type: string description: >- URL of the survey or experiment you want participant to access. You can pass URL search parameters to your survey or experiment * Participant id {{%PROLIFIC_PID%}} * Study id {{%STUDY_ID%}} * Session id {{%SESSION_ID%}} For example `https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}` prolific_id_option: $ref: '#/components/schemas/BaseStudyProlificIdOption' description: >- Use 'question' if you will add a question in your survey or experiment asking the participant ID **Recommended** Use 'url_parameters' if your survey or experiment can retrieve and store those parameters for your analysis. Use 'not_required' if you don't need to record them. completion_codes: type: array items: $ref: '#/components/schemas/BaseStudyCompletionCodesItems' description: >- Specify at least one completion code for your study. A participant will enter one of these codes when they complete your study. Each code must be unique within a study. You can specify as many actions as you like per code. However, some actions can't be used together (e.g. AutomaticallyApprove and ManuallyReview). total_available_places: type: number format: double description: >- How many participants are you looking to recruit. **Note:** This field is optional when `data_collection_method` is set to `DC_TOOL` or `AI_TASK_BUILDER` (AI Task Builder), as the total available places are automatically calculated from the batch configuration. estimated_completion_time: type: number format: double description: Estimated duration in minutes of the experiment or survey maximum_allowed_time: type: number format: double description: >- Max time in minutes for a participant to finish the submission. Submissions are timed out if it takes longer. If it is not provided the default value is set to the max value. The min value is calculated as two minutes plus two times the estimated time plus two times the square root of the estimated time reward: type: number format: double description: |- How much are you going to pay the participants in cents. We use the currency of your account. device_compatibility: type: array items: $ref: '#/components/schemas/BaseStudyDeviceCompatibilityItems' description: |- Add all devices that participants can use. You can include one or more options. An empty array indicates that all options are available. peripheral_requirements: type: array items: $ref: '#/components/schemas/BaseStudyPeripheralRequirementsItems' description: >- Add all requirements that participants have to meet. An empty array indicates that there are no extra peripheral requirements. filters: type: - array - 'null' items: $ref: '#/components/schemas/BaseStudyFiltersItems' description: |- Array of filters. Use empty array for "Everyone" filter_set_id: type: - string - 'null' description: >- The ID of a filter set, from which filters for the study will be taken. Note, this cannot be used in combination with additional filters via the `filters` field. filter_set_version: type: - integer - 'null' description: >- The version of the filter set to be used. If not provided, this will default to the latest available version at the time of applying the filter set. naivety_distribution_rate: type: - number - 'null' format: double description: >- Control the balance between speed of your studies and the naivety of the participants. If not defined, by default Prolific calculates the best rate for most studies taking into account the `filters` and the `total_available_places` needed for this study. Use 0 if your priority is speed. When this property is set to 0 all eligible participants will have access to your study at the same time, without any prioritization. You can also set this at a workspace and project level. project: type: string description: >- Project ID. When you don't specify a project in your request, Prolific automatically uses your first created project as the default. For clarity, we recommend explicitly including the project ID in your requests. submissions_config: $ref: '#/components/schemas/BaseStudySubmissionsConfig' description: >- **Advanced**: This helps with faster data collection. Your survey system will need to handle providing a unique experience each time the participant takes the study. Configuration related to study submissions. The purpose of this field is to capture any configuration options that impact the submissions made by participants in a study. study_labels: type: array items: $ref: '#/components/schemas/BaseStudyStudyLabelsItems' description: >- This field allows you to tag studies with information about the type/topic of the study and the kind of work involved in completing it. We plan to make this information available to participants for easier self-selection. At present these options are mutually exclusive and only a single option can be selected, however in the future available categories will expand. content_warnings: type: array items: $ref: '#/components/schemas/BaseStudyContentWarningsItems' description: >- Allow researchers to define content warnings for their study. At present these options are mutually exclusive and only a single option can be selected, however in the future available warnings will expand. content_warning_details: type: string description: >- Allow researchers to add further details about their content warning. metadata: type: - string - 'null' description: >- This field can be used to store extra information required for a system integration. For example, it could be some JSON, XML, an integer, or a string. Examples could include: - `123345` - An ID from your system, that helps with linkage when returning the study. - `{ \"id\": \"45\", \"type\": \"finance\"}` - Some JSON that you want to store. credential_pool_id: type: - string - 'null' description: >- The ID of the credential pool to associate with this study. Credential pools contain username/password pairs that are distributed to participants when they start the study. When provided, participants will be assigned unique credentials from the pool. Each credential can only be used once and is tracked throughout the study lifecycle. **Note:** The credential pool must: - Exist and belong to the study's workspace - Have available (unredeemed) credentials See the [Credentials endpoints](#tag/Credentials) for managing credential pools. has_credentials: type: boolean description: >- Indicates whether this study requires participants to use credentials. This field is automatically set to `true` when a `credential_pool_id` is provided, and `false` when the credential pool is removed. **Note:** This field is automatically managed based on the `credential_pool_id` field and does not need to be set manually. data_collection_method: oneOf: - $ref: '#/components/schemas/BaseStudyDataCollectionMethod' - type: 'null' description: >- **Optional.** Specifies the data collection method for the study. - `DC_TOOL`: Use AI Task Builder for data annotation and collection tasks (legacy value). - `AI_TASK_BUILDER`: Use AI Task Builder for data annotation and collection tasks. **Note:** This field is mutually exclusive with `external_study_url` and `access_details`. If not provided, you must specify one of those fields instead. data_collection_id: type: - string - 'null' description: >- The ID of the data collection batch or project from the Task Builder API. **Required when `data_collection_method` is set to `DC_TOOL` or `AI_TASK_BUILDER`.** data_collection_metadata: oneOf: - $ref: '#/components/schemas/BaseStudyDataCollectionMetadata' - type: 'null' description: >- **Optional.** Additional metadata for configuring AI Task Builder data collection behavior. Only used when `data_collection_method` is set to `DC_TOOL` or `AI_TASK_BUILDER`. **Properties:** - `annotators_per_task` (integer): Number of annotators per task. **This field must be provided if you want multiple annotators per task.** Without this field, the default value of 1 will be used. - Minimum: 1 - Default: 1 (if not provided) **Example:** ```json { "annotators_per_task": 5 } ``` **Important:** You must include `annotators_per_task` to control how many participants annotate each task. After the study is published, this value can only be increased (not decreased), which will increase the total available places on the study. access_details: type: - array - 'null' items: $ref: '#/components/schemas/BaseStudyAccessDetailsItems' description: >- Array of access_details, which integrates with taskflow. While this field is nullable, you must provide one of `access_details` or `external_study_url`. The sum of all access_details must add to the `total_available_places` field, however the values can be different for an individual access_detail. is_external_study_url_secure: type: boolean description: >- When set to true, any query parameters in the external study url will be signed with a JSON Web Token. The token will be added to the URL as a query parameter named `prolific_token`. This feature is only available to certain workspaces. **The JWT payload** Header: ```json { "alg": "RS256", "kid": "", "typ": "JWT" } ``` Where - alg is always RS256. - kid indicates the key ID that was used to secure the JWT. - typ is always JWT. Payload: ```json { "iss": "https://www.prolific.com", "iat": , "exp": , "aud": "", "sub": "", "prolific":{ "": "", "": "", ... } } ``` For example: ```json { "iss": "https://www.prolific.com", "iat": 1740496135, "exp": 1740496255, "aud": "https://x.com?STUDY_ID=1&...", "sub": "1234", "prolific":{ "STUDY_ID": "abcd", "SESSION_ID": "1234", "PROLIFIC_PID": "xyz" } } ``` **Verify the payload** When you receive the JWT, you must verify the following: - The JWT signature is authentic by verifying it with the public key from Prolific that correlates with the KID. The public keys can be retrieved from [/.well-known/study/jwks.json](#tag/Well-Known-Endpoints/paths/~1.well-known~1study~1jwks.json/get). - The JWT hasn't expired, by checking the `exp` claim. - The `aud` claim is the correct domain for your tool. - The `prolific` value matches your expected payload as set in the `external_study_url` property. StudyStatus: type: string enum: - value: UNPUBLISHED - value: SCHEDULED - value: PUBLISHING - value: ACTIVE - value: AWAITING REVIEW - value: PAUSED - value: COMPLETED Study: type: object properties: name: type: string description: Public name or title of the study internal_name: type: - string - 'null' description: Internal name of the study, not shown to participants description: type: string description: >- Description of the study for the participants to read before starting the study **Supported HTML in `description`** The `description` field supports the following HTML tags for formatting participant instructions: * `` - bold * `` - italic * `` - emphasized text * `` - strong importance * `` - strikethrough * `` - underline * `

      ` - heading level 1 * `

      ` - heading level 2 * `
        ` - ordered list * `
          ` - unordered list * `
        • ` - list item * `

          ` - paragraph Other HTML tags will be stripped or escaped. Please ensure that you only use supported tags for formatting to avoid rendering issues. external_study_url: type: string description: >- URL of the survey or experiment you want participant to access. You can pass URL search parameters to your survey or experiment * Participant id {{%PROLIFIC_PID%}} * Study id {{%STUDY_ID%}} * Session id {{%SESSION_ID%}} For example `https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}` prolific_id_option: $ref: '#/components/schemas/BaseStudyProlificIdOption' description: >- Use 'question' if you will add a question in your survey or experiment asking the participant ID **Recommended** Use 'url_parameters' if your survey or experiment can retrieve and store those parameters for your analysis. Use 'not_required' if you don't need to record them. completion_codes: type: array items: $ref: '#/components/schemas/BaseStudyCompletionCodesItems' description: >- Specify at least one completion code for your study. A participant will enter one of these codes when they complete your study. Each code must be unique within a study. You can specify as many actions as you like per code. However, some actions can't be used together (e.g. AutomaticallyApprove and ManuallyReview). total_available_places: type: number format: double description: >- How many participants are you looking to recruit. **Note:** This field is optional when `data_collection_method` is set to `DC_TOOL` or `AI_TASK_BUILDER` (AI Task Builder), as the total available places are automatically calculated from the batch configuration. estimated_completion_time: type: number format: double description: Estimated duration in minutes of the experiment or survey maximum_allowed_time: type: number format: double description: >- Max time in minutes for a participant to finish the submission. Submissions are timed out if it takes longer. If it is not provided the default value is set to the max value. The min value is calculated as two minutes plus two times the estimated time plus two times the square root of the estimated time reward: type: number format: double description: |- How much are you going to pay the participants in cents. We use the currency of your account. device_compatibility: type: array items: $ref: '#/components/schemas/BaseStudyDeviceCompatibilityItems' description: |- Add all devices that participants can use. You can include one or more options. An empty array indicates that all options are available. peripheral_requirements: type: array items: $ref: '#/components/schemas/BaseStudyPeripheralRequirementsItems' description: >- Add all requirements that participants have to meet. An empty array indicates that there are no extra peripheral requirements. filters: type: - array - 'null' items: $ref: '#/components/schemas/BaseStudyFiltersItems' description: |- Array of filters. Use empty array for "Everyone" filter_set_id: type: - string - 'null' description: >- The ID of a filter set, from which filters for the study will be taken. Note, this cannot be used in combination with additional filters via the `filters` field. filter_set_version: type: - integer - 'null' description: >- The version of the filter set to be used. If not provided, this will default to the latest available version at the time of applying the filter set. naivety_distribution_rate: type: - number - 'null' format: double description: >- Control the balance between speed of your studies and the naivety of the participants. If not defined, by default Prolific calculates the best rate for most studies taking into account the `filters` and the `total_available_places` needed for this study. Use 0 if your priority is speed. When this property is set to 0 all eligible participants will have access to your study at the same time, without any prioritization. You can also set this at a workspace and project level. project: type: string description: >- Project ID. When you don't specify a project in your request, Prolific automatically uses your first created project as the default. For clarity, we recommend explicitly including the project ID in your requests. submissions_config: $ref: '#/components/schemas/BaseStudySubmissionsConfig' description: >- **Advanced**: This helps with faster data collection. Your survey system will need to handle providing a unique experience each time the participant takes the study. Configuration related to study submissions. The purpose of this field is to capture any configuration options that impact the submissions made by participants in a study. study_labels: type: array items: $ref: '#/components/schemas/BaseStudyStudyLabelsItems' description: >- This field allows you to tag studies with information about the type/topic of the study and the kind of work involved in completing it. We plan to make this information available to participants for easier self-selection. At present these options are mutually exclusive and only a single option can be selected, however in the future available categories will expand. content_warnings: type: array items: $ref: '#/components/schemas/BaseStudyContentWarningsItems' description: >- Allow researchers to define content warnings for their study. At present these options are mutually exclusive and only a single option can be selected, however in the future available warnings will expand. content_warning_details: type: string description: >- Allow researchers to add further details about their content warning. metadata: type: - string - 'null' description: >- This field can be used to store extra information required for a system integration. For example, it could be some JSON, XML, an integer, or a string. Examples could include: - `123345` - An ID from your system, that helps with linkage when returning the study. - `{ \"id\": \"45\", \"type\": \"finance\"}` - Some JSON that you want to store. credential_pool_id: type: - string - 'null' description: >- The ID of the credential pool to associate with this study. Credential pools contain username/password pairs that are distributed to participants when they start the study. When provided, participants will be assigned unique credentials from the pool. Each credential can only be used once and is tracked throughout the study lifecycle. **Note:** The credential pool must: - Exist and belong to the study's workspace - Have available (unredeemed) credentials See the [Credentials endpoints](#tag/Credentials) for managing credential pools. has_credentials: type: boolean description: >- Indicates whether this study requires participants to use credentials. This field is automatically set to `true` when a `credential_pool_id` is provided, and `false` when the credential pool is removed. **Note:** This field is automatically managed based on the `credential_pool_id` field and does not need to be set manually. data_collection_method: oneOf: - $ref: '#/components/schemas/BaseStudyDataCollectionMethod' - type: 'null' description: >- **Optional.** Specifies the data collection method for the study. - `DC_TOOL`: Use AI Task Builder for data annotation and collection tasks (legacy value). - `AI_TASK_BUILDER`: Use AI Task Builder for data annotation and collection tasks. **Note:** This field is mutually exclusive with `external_study_url` and `access_details`. If not provided, you must specify one of those fields instead. data_collection_id: type: - string - 'null' description: >- The ID of the data collection batch or project from the Task Builder API. **Required when `data_collection_method` is set to `DC_TOOL` or `AI_TASK_BUILDER`.** data_collection_metadata: oneOf: - $ref: '#/components/schemas/BaseStudyDataCollectionMetadata' - type: 'null' description: >- **Optional.** Additional metadata for configuring AI Task Builder data collection behavior. Only used when `data_collection_method` is set to `DC_TOOL` or `AI_TASK_BUILDER`. **Properties:** - `annotators_per_task` (integer): Number of annotators per task. **This field must be provided if you want multiple annotators per task.** Without this field, the default value of 1 will be used. - Minimum: 1 - Default: 1 (if not provided) **Example:** ```json { "annotators_per_task": 5 } ``` **Important:** You must include `annotators_per_task` to control how many participants annotate each task. After the study is published, this value can only be increased (not decreased), which will increase the total available places on the study. access_details: type: - array - 'null' items: $ref: '#/components/schemas/BaseStudyAccessDetailsItems' description: >- Array of access_details, which integrates with taskflow. While this field is nullable, you must provide one of `access_details` or `external_study_url`. The sum of all access_details must add to the `total_available_places` field, however the values can be different for an individual access_detail. is_external_study_url_secure: type: boolean description: >- When set to true, any query parameters in the external study url will be signed with a JSON Web Token. The token will be added to the URL as a query parameter named `prolific_token`. This feature is only available to certain workspaces. **The JWT payload** Header: ```json { "alg": "RS256", "kid": "", "typ": "JWT" } ``` Where - alg is always RS256. - kid indicates the key ID that was used to secure the JWT. - typ is always JWT. Payload: ```json { "iss": "https://www.prolific.com", "iat": , "exp": , "aud": "", "sub": "", "prolific":{ "": "", "": "", ... } } ``` For example: ```json { "iss": "https://www.prolific.com", "iat": 1740496135, "exp": 1740496255, "aud": "https://x.com?STUDY_ID=1&...", "sub": "1234", "prolific":{ "STUDY_ID": "abcd", "SESSION_ID": "1234", "PROLIFIC_PID": "xyz" } } ``` **Verify the payload** When you receive the JWT, you must verify the following: - The JWT signature is authentic by verifying it with the public key from Prolific that correlates with the KID. The public keys can be retrieved from [/.well-known/study/jwks.json](#tag/Well-Known-Endpoints/paths/~1.well-known~1study~1jwks.json/get). - The JWT hasn't expired, by checking the `exp` claim. - The `aud` claim is the correct domain for your tool. - The `prolific` value matches your expected payload as set in the `external_study_url` property. id: type: string description: Study id. It is created by Prolific. **Read only**. status: $ref: '#/components/schemas/StudyStatus' description: |- Status of the study. **Read only**. To change the status you can use `/api/v1/studies/{id}/transition/` ``` ## SDK Code Examples ```python study_with_allow_list import requests url = "https://api.prolific.com/api/v1/studies/" payload = { "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [{ "action": "AUTOMATICALLY_APPROVE" }] }, { "code": "DEF234", "code_type": "FOLLOW_UP_STUDY", "actions": [ { "action": "AUTOMATICALLY_APPROVE" }, { "action": "ADD_TO_PARTICIPANT_GROUP", "participant_group": "619e049f7648a4e1f8f3645b" } ] } ], "description": "This study aims to determine how to make a good public API", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 5, "external_study_url": "https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}", "filters": [ { "filter_id": "custom_allowlist", "selected_values": ["619e049f7648a4e1f8f3645b"] } ], "internal_name": "WIT-2022 Study about API's version 2", "name": "Study about API's for selected participants", "peripheral_requirements": [], "prolific_id_option": "url_parameters", "reward": 13, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 30 } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript study_with_allow_list const url = 'https://api.prolific.com/api/v1/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"completion_codes":[{"code":"ABC123","code_type":"COMPLETED","actions":[{"action":"AUTOMATICALLY_APPROVE"}]},{"code":"DEF234","code_type":"FOLLOW_UP_STUDY","actions":[{"action":"AUTOMATICALLY_APPROVE"},{"action":"ADD_TO_PARTICIPANT_GROUP","participant_group":"619e049f7648a4e1f8f3645b"}]}],"description":"This study aims to determine how to make a good public API","device_compatibility":["mobile","desktop","tablet"],"estimated_completion_time":5,"external_study_url":"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}","filters":[{"filter_id":"custom_allowlist","selected_values":["619e049f7648a4e1f8f3645b"]}],"internal_name":"WIT-2022 Study about API\'s version 2","name":"Study about API\'s for selected participants","peripheral_requirements":[],"prolific_id_option":"url_parameters","reward":13,"submissions_config":{"max_submissions_per_participant":1},"total_available_places":30}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go study_with_allow_list package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/studies/" payload := strings.NewReader("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"FOLLOW_UP_STUDY\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"This study aims to determine how to make a good public API\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"filters\": [\n {\n \"filter_id\": \"custom_allowlist\",\n \"selected_values\": [\n \"619e049f7648a4e1f8f3645b\"\n ]\n }\n ],\n \"internal_name\": \"WIT-2022 Study about API's version 2\",\n \"name\": \"Study about API's for selected participants\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\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 study_with_allow_list require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/studies/") 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 \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"FOLLOW_UP_STUDY\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"This study aims to determine how to make a good public API\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"filters\": [\n {\n \"filter_id\": \"custom_allowlist\",\n \"selected_values\": [\n \"619e049f7648a4e1f8f3645b\"\n ]\n }\n ],\n \"internal_name\": \"WIT-2022 Study about API's version 2\",\n \"name\": \"Study about API's for selected participants\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\n}" response = http.request(request) puts response.read_body ``` ```java study_with_allow_list HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"FOLLOW_UP_STUDY\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"This study aims to determine how to make a good public API\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"filters\": [\n {\n \"filter_id\": \"custom_allowlist\",\n \"selected_values\": [\n \"619e049f7648a4e1f8f3645b\"\n ]\n }\n ],\n \"internal_name\": \"WIT-2022 Study about API's version 2\",\n \"name\": \"Study about API's for selected participants\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\n}") .asString(); ``` ```php study_with_allow_list request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [ { "action": "AUTOMATICALLY_APPROVE" } ] }, { "code": "DEF234", "code_type": "FOLLOW_UP_STUDY", "actions": [ { "action": "AUTOMATICALLY_APPROVE" }, { "action": "ADD_TO_PARTICIPANT_GROUP", "participant_group": "619e049f7648a4e1f8f3645b" } ] } ], "description": "This study aims to determine how to make a good public API", "device_compatibility": [ "mobile", "desktop", "tablet" ], "estimated_completion_time": 5, "external_study_url": "https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}", "filters": [ { "filter_id": "custom_allowlist", "selected_values": [ "619e049f7648a4e1f8f3645b" ] } ], "internal_name": "WIT-2022 Study about API\'s version 2", "name": "Study about API\'s for selected participants", "peripheral_requirements": [], "prolific_id_option": "url_parameters", "reward": 13, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 30 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp study_with_allow_list var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"FOLLOW_UP_STUDY\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"This study aims to determine how to make a good public API\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"filters\": [\n {\n \"filter_id\": \"custom_allowlist\",\n \"selected_values\": [\n \"619e049f7648a4e1f8f3645b\"\n ]\n }\n ],\n \"internal_name\": \"WIT-2022 Study about API's version 2\",\n \"name\": \"Study about API's for selected participants\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift study_with_allow_list import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "completion_codes": [ [ "code": "ABC123", "code_type": "COMPLETED", "actions": [["action": "AUTOMATICALLY_APPROVE"]] ], [ "code": "DEF234", "code_type": "FOLLOW_UP_STUDY", "actions": [ ["action": "AUTOMATICALLY_APPROVE"], [ "action": "ADD_TO_PARTICIPANT_GROUP", "participant_group": "619e049f7648a4e1f8f3645b" ] ] ] ], "description": "This study aims to determine how to make a good public API", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 5, "external_study_url": "https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}", "filters": [ [ "filter_id": "custom_allowlist", "selected_values": ["619e049f7648a4e1f8f3645b"] ] ], "internal_name": "WIT-2022 Study about API's version 2", "name": "Study about API's for selected participants", "peripheral_requirements": [], "prolific_id_option": "url_parameters", "reward": 13, "submissions_config": ["max_submissions_per_participant": 1], "total_available_places": 30 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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 study_with_participant_recording import requests url = "https://api.prolific.com/api/v1/studies/" payload = { "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [{ "action": "AUTOMATICALLY_APPROVE" }] } ], "description": "This study aims to determine how to make a good public API with participant recording", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 5, "external_study_url": "https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}", "internal_name": "Study about API's with participant recording", "name": "Study about API's with participant recording", "peripheral_requirements": [], "prolific_id_option": "url_parameters", "reward": 13, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 10 } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript study_with_participant_recording const url = 'https://api.prolific.com/api/v1/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"completion_codes":[{"code":"ABC123","code_type":"COMPLETED","actions":[{"action":"AUTOMATICALLY_APPROVE"}]}],"description":"This study aims to determine how to make a good public API with participant recording","device_compatibility":["mobile","desktop","tablet"],"estimated_completion_time":5,"external_study_url":"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}","internal_name":"Study about API\'s with participant recording","name":"Study about API\'s with participant recording","peripheral_requirements":[],"prolific_id_option":"url_parameters","reward":13,"submissions_config":{"max_submissions_per_participant":1},"total_available_places":10}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go study_with_participant_recording package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/studies/" payload := strings.NewReader("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n }\n ],\n \"description\": \"This study aims to determine how to make a good public API with participant recording\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"internal_name\": \"Study about API's with participant recording\",\n \"name\": \"Study about API's with participant recording\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 10\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 study_with_participant_recording require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/studies/") 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 \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n }\n ],\n \"description\": \"This study aims to determine how to make a good public API with participant recording\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"internal_name\": \"Study about API's with participant recording\",\n \"name\": \"Study about API's with participant recording\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 10\n}" response = http.request(request) puts response.read_body ``` ```java study_with_participant_recording HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n }\n ],\n \"description\": \"This study aims to determine how to make a good public API with participant recording\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"internal_name\": \"Study about API's with participant recording\",\n \"name\": \"Study about API's with participant recording\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 10\n}") .asString(); ``` ```php study_with_participant_recording request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [ { "action": "AUTOMATICALLY_APPROVE" } ] } ], "description": "This study aims to determine how to make a good public API with participant recording", "device_compatibility": [ "mobile", "desktop", "tablet" ], "estimated_completion_time": 5, "external_study_url": "https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}", "internal_name": "Study about API\'s with participant recording", "name": "Study about API\'s with participant recording", "peripheral_requirements": [], "prolific_id_option": "url_parameters", "reward": 13, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 10 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp study_with_participant_recording var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n }\n ],\n \"description\": \"This study aims to determine how to make a good public API with participant recording\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"internal_name\": \"Study about API's with participant recording\",\n \"name\": \"Study about API's with participant recording\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 10\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift study_with_participant_recording import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "completion_codes": [ [ "code": "ABC123", "code_type": "COMPLETED", "actions": [["action": "AUTOMATICALLY_APPROVE"]] ] ], "description": "This study aims to determine how to make a good public API with participant recording", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 5, "external_study_url": "https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}", "internal_name": "Study about API's with participant recording", "name": "Study about API's with participant recording", "peripheral_requirements": [], "prolific_id_option": "url_parameters", "reward": 13, "submissions_config": ["max_submissions_per_participant": 1], "total_available_places": 10 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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 study_with_blocked_studies import requests url = "https://api.prolific.com/api/v1/studies/" payload = { "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [{ "action": "AUTOMATICALLY_APPROVE" }] }, { "code": "DEF234", "code_type": "FOLLOW_UP_STUDY", "actions": [ { "action": "AUTOMATICALLY_APPROVE" }, { "action": "ADD_TO_PARTICIPANT_GROUP", "participant_group": "619e049f7648a4e1f8f3645b" } ] } ], "description": "This study is not accessible to participants of studies 319e049f7648a4e1f8f3645a and 919e049f7648a4e1f8f3645d", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 5, "external_study_url": "https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}", "filters": [ { "filter_id": "previous_studies_blocklist", "selected_values": ["619e049f7648a4e1f8f3645b"] } ], "name": "Study about APIs with blocked studies", "peripheral_requirements": [], "prolific_id_option": "url_parameters", "reward": 100, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 30 } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript study_with_blocked_studies const url = 'https://api.prolific.com/api/v1/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"completion_codes":[{"code":"ABC123","code_type":"COMPLETED","actions":[{"action":"AUTOMATICALLY_APPROVE"}]},{"code":"DEF234","code_type":"FOLLOW_UP_STUDY","actions":[{"action":"AUTOMATICALLY_APPROVE"},{"action":"ADD_TO_PARTICIPANT_GROUP","participant_group":"619e049f7648a4e1f8f3645b"}]}],"description":"This study is not accessible to participants of studies 319e049f7648a4e1f8f3645a and 919e049f7648a4e1f8f3645d","device_compatibility":["mobile","desktop","tablet"],"estimated_completion_time":5,"external_study_url":"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}","filters":[{"filter_id":"previous_studies_blocklist","selected_values":["619e049f7648a4e1f8f3645b"]}],"name":"Study about APIs with blocked studies","peripheral_requirements":[],"prolific_id_option":"url_parameters","reward":100,"submissions_config":{"max_submissions_per_participant":1},"total_available_places":30}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go study_with_blocked_studies package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/studies/" payload := strings.NewReader("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"FOLLOW_UP_STUDY\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"This study is not accessible to participants of studies 319e049f7648a4e1f8f3645a and 919e049f7648a4e1f8f3645d\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"filters\": [\n {\n \"filter_id\": \"previous_studies_blocklist\",\n \"selected_values\": [\n \"619e049f7648a4e1f8f3645b\"\n ]\n }\n ],\n \"name\": \"Study about APIs with blocked studies\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\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 study_with_blocked_studies require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/studies/") 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 \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"FOLLOW_UP_STUDY\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"This study is not accessible to participants of studies 319e049f7648a4e1f8f3645a and 919e049f7648a4e1f8f3645d\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"filters\": [\n {\n \"filter_id\": \"previous_studies_blocklist\",\n \"selected_values\": [\n \"619e049f7648a4e1f8f3645b\"\n ]\n }\n ],\n \"name\": \"Study about APIs with blocked studies\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\n}" response = http.request(request) puts response.read_body ``` ```java study_with_blocked_studies HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"FOLLOW_UP_STUDY\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"This study is not accessible to participants of studies 319e049f7648a4e1f8f3645a and 919e049f7648a4e1f8f3645d\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"filters\": [\n {\n \"filter_id\": \"previous_studies_blocklist\",\n \"selected_values\": [\n \"619e049f7648a4e1f8f3645b\"\n ]\n }\n ],\n \"name\": \"Study about APIs with blocked studies\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\n}") .asString(); ``` ```php study_with_blocked_studies request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [ { "action": "AUTOMATICALLY_APPROVE" } ] }, { "code": "DEF234", "code_type": "FOLLOW_UP_STUDY", "actions": [ { "action": "AUTOMATICALLY_APPROVE" }, { "action": "ADD_TO_PARTICIPANT_GROUP", "participant_group": "619e049f7648a4e1f8f3645b" } ] } ], "description": "This study is not accessible to participants of studies 319e049f7648a4e1f8f3645a and 919e049f7648a4e1f8f3645d", "device_compatibility": [ "mobile", "desktop", "tablet" ], "estimated_completion_time": 5, "external_study_url": "https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}", "filters": [ { "filter_id": "previous_studies_blocklist", "selected_values": [ "619e049f7648a4e1f8f3645b" ] } ], "name": "Study about APIs with blocked studies", "peripheral_requirements": [], "prolific_id_option": "url_parameters", "reward": 100, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 30 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp study_with_blocked_studies var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"FOLLOW_UP_STUDY\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"This study is not accessible to participants of studies 319e049f7648a4e1f8f3645a and 919e049f7648a4e1f8f3645d\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"filters\": [\n {\n \"filter_id\": \"previous_studies_blocklist\",\n \"selected_values\": [\n \"619e049f7648a4e1f8f3645b\"\n ]\n }\n ],\n \"name\": \"Study about APIs with blocked studies\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift study_with_blocked_studies import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "completion_codes": [ [ "code": "ABC123", "code_type": "COMPLETED", "actions": [["action": "AUTOMATICALLY_APPROVE"]] ], [ "code": "DEF234", "code_type": "FOLLOW_UP_STUDY", "actions": [ ["action": "AUTOMATICALLY_APPROVE"], [ "action": "ADD_TO_PARTICIPANT_GROUP", "participant_group": "619e049f7648a4e1f8f3645b" ] ] ] ], "description": "This study is not accessible to participants of studies 319e049f7648a4e1f8f3645a and 919e049f7648a4e1f8f3645d", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 5, "external_study_url": "https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}", "filters": [ [ "filter_id": "previous_studies_blocklist", "selected_values": ["619e049f7648a4e1f8f3645b"] ] ], "name": "Study about APIs with blocked studies", "peripheral_requirements": [], "prolific_id_option": "url_parameters", "reward": 100, "submissions_config": ["max_submissions_per_participant": 1], "total_available_places": 30 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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 minimal_study import requests url = "https://api.prolific.com/api/v1/studies/" payload = { "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [{ "action": "MANUALLY_REVIEW" }] } ], "description": "Study configured with only the required fields for 10 places and £1 reward", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://example.com", "filters": [], "name": "Minimally Configured Study", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 100, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 10 } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript minimal_study const url = 'https://api.prolific.com/api/v1/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"completion_codes":[{"code":"ABC123","code_type":"COMPLETED","actions":[{"action":"MANUALLY_REVIEW"}]}],"description":"Study configured with only the required fields for 10 places and £1 reward","device_compatibility":["mobile","desktop","tablet"],"estimated_completion_time":1,"external_study_url":"https://example.com","filters":[],"name":"Minimally Configured Study","peripheral_requirements":[],"prolific_id_option":"question","reward":100,"submissions_config":{"max_submissions_per_participant":1},"total_available_places":10}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go minimal_study package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/studies/" payload := strings.NewReader("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"Study configured with only the required fields for 10 places and £1 reward\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://example.com\",\n \"filters\": [],\n \"name\": \"Minimally Configured Study\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 10\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 minimal_study require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/studies/") 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 \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"Study configured with only the required fields for 10 places and £1 reward\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://example.com\",\n \"filters\": [],\n \"name\": \"Minimally Configured Study\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 10\n}" response = http.request(request) puts response.read_body ``` ```java minimal_study HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"Study configured with only the required fields for 10 places and £1 reward\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://example.com\",\n \"filters\": [],\n \"name\": \"Minimally Configured Study\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 10\n}") .asString(); ``` ```php minimal_study request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [ { "action": "MANUALLY_REVIEW" } ] } ], "description": "Study configured with only the required fields for 10 places and £1 reward", "device_compatibility": [ "mobile", "desktop", "tablet" ], "estimated_completion_time": 1, "external_study_url": "https://example.com", "filters": [], "name": "Minimally Configured Study", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 100, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 10 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp minimal_study var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"Study configured with only the required fields for 10 places and £1 reward\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://example.com\",\n \"filters\": [],\n \"name\": \"Minimally Configured Study\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 10\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift minimal_study import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "completion_codes": [ [ "code": "ABC123", "code_type": "COMPLETED", "actions": [["action": "MANUALLY_REVIEW"]] ] ], "description": "Study configured with only the required fields for 10 places and £1 reward", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://example.com", "filters": [], "name": "Minimally Configured Study", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 100, "submissions_config": ["max_submissions_per_participant": 1], "total_available_places": 10 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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 study_in_project import requests url = "https://api.prolific.com/api/v1/studies/" payload = { "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [{ "action": "AUTOMATICALLY_APPROVE" }] }, { "code": "DEF234", "code_type": "FOLLOW_UP_STUDY", "actions": [ { "action": "AUTOMATICALLY_APPROVE" }, { "action": "ADD_TO_PARTICIPANT_GROUP", "participant_group": "619e049f7648a4e1f8f3645b" } ] } ], "description": "study in project", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [], "name": "Study in project", "peripheral_requirements": [], "project": "619e049f7648a4e1f8f3645b", "prolific_id_option": "question", "reward": 100, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 500 } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript study_in_project const url = 'https://api.prolific.com/api/v1/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"completion_codes":[{"code":"ABC123","code_type":"COMPLETED","actions":[{"action":"AUTOMATICALLY_APPROVE"}]},{"code":"DEF234","code_type":"FOLLOW_UP_STUDY","actions":[{"action":"AUTOMATICALLY_APPROVE"},{"action":"ADD_TO_PARTICIPANT_GROUP","participant_group":"619e049f7648a4e1f8f3645b"}]}],"description":"study in project","device_compatibility":["mobile","desktop","tablet"],"estimated_completion_time":1,"external_study_url":"https://google.com","filters":[],"name":"Study in project","peripheral_requirements":[],"project":"619e049f7648a4e1f8f3645b","prolific_id_option":"question","reward":100,"submissions_config":{"max_submissions_per_participant":1},"total_available_places":500}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go study_in_project package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/studies/" payload := strings.NewReader("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"FOLLOW_UP_STUDY\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"study in project\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [],\n \"name\": \"Study in project\",\n \"peripheral_requirements\": [],\n \"project\": \"619e049f7648a4e1f8f3645b\",\n \"prolific_id_option\": \"question\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\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 study_in_project require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/studies/") 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 \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"FOLLOW_UP_STUDY\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"study in project\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [],\n \"name\": \"Study in project\",\n \"peripheral_requirements\": [],\n \"project\": \"619e049f7648a4e1f8f3645b\",\n \"prolific_id_option\": \"question\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}" response = http.request(request) puts response.read_body ``` ```java study_in_project HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"FOLLOW_UP_STUDY\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"study in project\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [],\n \"name\": \"Study in project\",\n \"peripheral_requirements\": [],\n \"project\": \"619e049f7648a4e1f8f3645b\",\n \"prolific_id_option\": \"question\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}") .asString(); ``` ```php study_in_project request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [ { "action": "AUTOMATICALLY_APPROVE" } ] }, { "code": "DEF234", "code_type": "FOLLOW_UP_STUDY", "actions": [ { "action": "AUTOMATICALLY_APPROVE" }, { "action": "ADD_TO_PARTICIPANT_GROUP", "participant_group": "619e049f7648a4e1f8f3645b" } ] } ], "description": "study in project", "device_compatibility": [ "mobile", "desktop", "tablet" ], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [], "name": "Study in project", "peripheral_requirements": [], "project": "619e049f7648a4e1f8f3645b", "prolific_id_option": "question", "reward": 100, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 500 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp study_in_project var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"FOLLOW_UP_STUDY\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"study in project\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [],\n \"name\": \"Study in project\",\n \"peripheral_requirements\": [],\n \"project\": \"619e049f7648a4e1f8f3645b\",\n \"prolific_id_option\": \"question\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift study_in_project import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "completion_codes": [ [ "code": "ABC123", "code_type": "COMPLETED", "actions": [["action": "AUTOMATICALLY_APPROVE"]] ], [ "code": "DEF234", "code_type": "FOLLOW_UP_STUDY", "actions": [ ["action": "AUTOMATICALLY_APPROVE"], [ "action": "ADD_TO_PARTICIPANT_GROUP", "participant_group": "619e049f7648a4e1f8f3645b" ] ] ] ], "description": "study in project", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [], "name": "Study in project", "peripheral_requirements": [], "project": "619e049f7648a4e1f8f3645b", "prolific_id_option": "question", "reward": 100, "submissions_config": ["max_submissions_per_participant": 1], "total_available_places": 500 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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 study_with_participant_group_allow_list import requests url = "https://api.prolific.com/api/v1/studies/" payload = { "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [{ "action": "AUTOMATICALLY_APPROVE" }] }, { "code": "DEF234", "code_type": "FOLLOW_UP_STUDY", "actions": [ { "action": "AUTOMATICALLY_APPROVE" }, { "action": "ADD_TO_PARTICIPANT_GROUP", "participant_group": "619e049f7648a4e1f8f3645b" } ] } ], "description": "This study aims to determine how to make a good public API", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 5, "external_study_url": "https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}", "filters": [ { "filter_id": "participant_group_allowlist", "selected_values": ["619e049f7648a4e1f8f3645b"] } ], "internal_name": "WIT-2022 Study about API's version 2", "name": "Study about API's for participants in my participant group", "peripheral_requirements": [], "prolific_id_option": "url_parameters", "reward": 13, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 30 } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript study_with_participant_group_allow_list const url = 'https://api.prolific.com/api/v1/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"completion_codes":[{"code":"ABC123","code_type":"COMPLETED","actions":[{"action":"AUTOMATICALLY_APPROVE"}]},{"code":"DEF234","code_type":"FOLLOW_UP_STUDY","actions":[{"action":"AUTOMATICALLY_APPROVE"},{"action":"ADD_TO_PARTICIPANT_GROUP","participant_group":"619e049f7648a4e1f8f3645b"}]}],"description":"This study aims to determine how to make a good public API","device_compatibility":["mobile","desktop","tablet"],"estimated_completion_time":5,"external_study_url":"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}","filters":[{"filter_id":"participant_group_allowlist","selected_values":["619e049f7648a4e1f8f3645b"]}],"internal_name":"WIT-2022 Study about API\'s version 2","name":"Study about API\'s for participants in my participant group","peripheral_requirements":[],"prolific_id_option":"url_parameters","reward":13,"submissions_config":{"max_submissions_per_participant":1},"total_available_places":30}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go study_with_participant_group_allow_list package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/studies/" payload := strings.NewReader("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"FOLLOW_UP_STUDY\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"This study aims to determine how to make a good public API\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"filters\": [\n {\n \"filter_id\": \"participant_group_allowlist\",\n \"selected_values\": [\n \"619e049f7648a4e1f8f3645b\"\n ]\n }\n ],\n \"internal_name\": \"WIT-2022 Study about API's version 2\",\n \"name\": \"Study about API's for participants in my participant group\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\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 study_with_participant_group_allow_list require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/studies/") 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 \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"FOLLOW_UP_STUDY\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"This study aims to determine how to make a good public API\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"filters\": [\n {\n \"filter_id\": \"participant_group_allowlist\",\n \"selected_values\": [\n \"619e049f7648a4e1f8f3645b\"\n ]\n }\n ],\n \"internal_name\": \"WIT-2022 Study about API's version 2\",\n \"name\": \"Study about API's for participants in my participant group\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\n}" response = http.request(request) puts response.read_body ``` ```java study_with_participant_group_allow_list HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"FOLLOW_UP_STUDY\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"This study aims to determine how to make a good public API\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"filters\": [\n {\n \"filter_id\": \"participant_group_allowlist\",\n \"selected_values\": [\n \"619e049f7648a4e1f8f3645b\"\n ]\n }\n ],\n \"internal_name\": \"WIT-2022 Study about API's version 2\",\n \"name\": \"Study about API's for participants in my participant group\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\n}") .asString(); ``` ```php study_with_participant_group_allow_list request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [ { "action": "AUTOMATICALLY_APPROVE" } ] }, { "code": "DEF234", "code_type": "FOLLOW_UP_STUDY", "actions": [ { "action": "AUTOMATICALLY_APPROVE" }, { "action": "ADD_TO_PARTICIPANT_GROUP", "participant_group": "619e049f7648a4e1f8f3645b" } ] } ], "description": "This study aims to determine how to make a good public API", "device_compatibility": [ "mobile", "desktop", "tablet" ], "estimated_completion_time": 5, "external_study_url": "https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}", "filters": [ { "filter_id": "participant_group_allowlist", "selected_values": [ "619e049f7648a4e1f8f3645b" ] } ], "internal_name": "WIT-2022 Study about API\'s version 2", "name": "Study about API\'s for participants in my participant group", "peripheral_requirements": [], "prolific_id_option": "url_parameters", "reward": 13, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 30 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp study_with_participant_group_allow_list var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"FOLLOW_UP_STUDY\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"This study aims to determine how to make a good public API\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"filters\": [\n {\n \"filter_id\": \"participant_group_allowlist\",\n \"selected_values\": [\n \"619e049f7648a4e1f8f3645b\"\n ]\n }\n ],\n \"internal_name\": \"WIT-2022 Study about API's version 2\",\n \"name\": \"Study about API's for participants in my participant group\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift study_with_participant_group_allow_list import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "completion_codes": [ [ "code": "ABC123", "code_type": "COMPLETED", "actions": [["action": "AUTOMATICALLY_APPROVE"]] ], [ "code": "DEF234", "code_type": "FOLLOW_UP_STUDY", "actions": [ ["action": "AUTOMATICALLY_APPROVE"], [ "action": "ADD_TO_PARTICIPANT_GROUP", "participant_group": "619e049f7648a4e1f8f3645b" ] ] ] ], "description": "This study aims to determine how to make a good public API", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 5, "external_study_url": "https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}", "filters": [ [ "filter_id": "participant_group_allowlist", "selected_values": ["619e049f7648a4e1f8f3645b"] ] ], "internal_name": "WIT-2022 Study about API's version 2", "name": "Study about API's for participants in my participant group", "peripheral_requirements": [], "prolific_id_option": "url_parameters", "reward": 13, "submissions_config": ["max_submissions_per_participant": 1], "total_available_places": 30 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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 study_with_participant_group_block_list import requests url = "https://api.prolific.com/api/v1/studies/" payload = { "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [{ "action": "AUTOMATICALLY_APPROVE" }] }, { "code": "DEF234", "code_type": "COMPLETED", "actions": [ { "action": "MANUALLY_REVIEW" }, { "action": "ADD_TO_PARTICIPANT_GROUP", "participant_group": "619e049f7648a4e1f8f3645b" } ] } ], "description": "This study aims to determine how to make a good public API", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 5, "external_study_url": "https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}", "filters": [ { "filter_id": "participant_group_blocklist", "selected_values": ["619e049f7648a4e1f8f3645b"] } ], "internal_name": "WIT-2022 Study about API's version 2", "name": "Study about API's for participants in my participant group", "peripheral_requirements": [], "prolific_id_option": "url_parameters", "reward": 13, "total_available_places": 30 } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript study_with_participant_group_block_list const url = 'https://api.prolific.com/api/v1/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"completion_codes":[{"code":"ABC123","code_type":"COMPLETED","actions":[{"action":"AUTOMATICALLY_APPROVE"}]},{"code":"DEF234","code_type":"COMPLETED","actions":[{"action":"MANUALLY_REVIEW"},{"action":"ADD_TO_PARTICIPANT_GROUP","participant_group":"619e049f7648a4e1f8f3645b"}]}],"description":"This study aims to determine how to make a good public API","device_compatibility":["mobile","desktop","tablet"],"estimated_completion_time":5,"external_study_url":"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}","filters":[{"filter_id":"participant_group_blocklist","selected_values":["619e049f7648a4e1f8f3645b"]}],"internal_name":"WIT-2022 Study about API\'s version 2","name":"Study about API\'s for participants in my participant group","peripheral_requirements":[],"prolific_id_option":"url_parameters","reward":13,"total_available_places":30}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go study_with_participant_group_block_list package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/studies/" payload := strings.NewReader("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"This study aims to determine how to make a good public API\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"filters\": [\n {\n \"filter_id\": \"participant_group_blocklist\",\n \"selected_values\": [\n \"619e049f7648a4e1f8f3645b\"\n ]\n }\n ],\n \"internal_name\": \"WIT-2022 Study about API's version 2\",\n \"name\": \"Study about API's for participants in my participant group\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 13,\n \"total_available_places\": 30\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 study_with_participant_group_block_list require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/studies/") 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 \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"This study aims to determine how to make a good public API\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"filters\": [\n {\n \"filter_id\": \"participant_group_blocklist\",\n \"selected_values\": [\n \"619e049f7648a4e1f8f3645b\"\n ]\n }\n ],\n \"internal_name\": \"WIT-2022 Study about API's version 2\",\n \"name\": \"Study about API's for participants in my participant group\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 13,\n \"total_available_places\": 30\n}" response = http.request(request) puts response.read_body ``` ```java study_with_participant_group_block_list HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"This study aims to determine how to make a good public API\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"filters\": [\n {\n \"filter_id\": \"participant_group_blocklist\",\n \"selected_values\": [\n \"619e049f7648a4e1f8f3645b\"\n ]\n }\n ],\n \"internal_name\": \"WIT-2022 Study about API's version 2\",\n \"name\": \"Study about API's for participants in my participant group\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 13,\n \"total_available_places\": 30\n}") .asString(); ``` ```php study_with_participant_group_block_list request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [ { "action": "AUTOMATICALLY_APPROVE" } ] }, { "code": "DEF234", "code_type": "COMPLETED", "actions": [ { "action": "MANUALLY_REVIEW" }, { "action": "ADD_TO_PARTICIPANT_GROUP", "participant_group": "619e049f7648a4e1f8f3645b" } ] } ], "description": "This study aims to determine how to make a good public API", "device_compatibility": [ "mobile", "desktop", "tablet" ], "estimated_completion_time": 5, "external_study_url": "https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}", "filters": [ { "filter_id": "participant_group_blocklist", "selected_values": [ "619e049f7648a4e1f8f3645b" ] } ], "internal_name": "WIT-2022 Study about API\'s version 2", "name": "Study about API\'s for participants in my participant group", "peripheral_requirements": [], "prolific_id_option": "url_parameters", "reward": 13, "total_available_places": 30 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp study_with_participant_group_block_list var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"This study aims to determine how to make a good public API\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"filters\": [\n {\n \"filter_id\": \"participant_group_blocklist\",\n \"selected_values\": [\n \"619e049f7648a4e1f8f3645b\"\n ]\n }\n ],\n \"internal_name\": \"WIT-2022 Study about API's version 2\",\n \"name\": \"Study about API's for participants in my participant group\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 13,\n \"total_available_places\": 30\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift study_with_participant_group_block_list import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "completion_codes": [ [ "code": "ABC123", "code_type": "COMPLETED", "actions": [["action": "AUTOMATICALLY_APPROVE"]] ], [ "code": "DEF234", "code_type": "COMPLETED", "actions": [ ["action": "MANUALLY_REVIEW"], [ "action": "ADD_TO_PARTICIPANT_GROUP", "participant_group": "619e049f7648a4e1f8f3645b" ] ] ] ], "description": "This study aims to determine how to make a good public API", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 5, "external_study_url": "https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}", "filters": [ [ "filter_id": "participant_group_blocklist", "selected_values": ["619e049f7648a4e1f8f3645b"] ] ], "internal_name": "WIT-2022 Study about API's version 2", "name": "Study about API's for participants in my participant group", "peripheral_requirements": [], "prolific_id_option": "url_parameters", "reward": 13, "total_available_places": 30 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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 multiple_participant_groups_either_or import requests url = "https://api.prolific.com/api/v1/studies/" payload = { "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [{ "action": "AUTOMATICALLY_APPROVE" }] } ], "description": "A participant can be in either of these groups to gain study access", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://eggs-experriment.com", "filters": [ { "filter_id": "participant_group_allowlist", "selected_values": ["64514609c0265e1da4a74127", "64660e2e0ce5307750bf5c99"] } ], "internal_name": "Study with multiple participant groups", "name": "Example where a participant can be in either participant group", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 100, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 30 } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript multiple_participant_groups_either_or const url = 'https://api.prolific.com/api/v1/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"completion_codes":[{"code":"ABC123","code_type":"COMPLETED","actions":[{"action":"AUTOMATICALLY_APPROVE"}]}],"description":"A participant can be in either of these groups to gain study access","device_compatibility":["mobile","desktop","tablet"],"estimated_completion_time":1,"external_study_url":"https://eggs-experriment.com","filters":[{"filter_id":"participant_group_allowlist","selected_values":["64514609c0265e1da4a74127","64660e2e0ce5307750bf5c99"]}],"internal_name":"Study with multiple participant groups","name":"Example where a participant can be in either participant group","peripheral_requirements":[],"prolific_id_option":"question","reward":100,"submissions_config":{"max_submissions_per_participant":1},"total_available_places":30}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go multiple_participant_groups_either_or package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/studies/" payload := strings.NewReader("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n }\n ],\n \"description\": \"A participant can be in either of these groups to gain study access\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://eggs-experriment.com\",\n \"filters\": [\n {\n \"filter_id\": \"participant_group_allowlist\",\n \"selected_values\": [\n \"64514609c0265e1da4a74127\",\n \"64660e2e0ce5307750bf5c99\"\n ]\n }\n ],\n \"internal_name\": \"Study with multiple participant groups\",\n \"name\": \"Example where a participant can be in either participant group\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\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 multiple_participant_groups_either_or require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/studies/") 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 \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n }\n ],\n \"description\": \"A participant can be in either of these groups to gain study access\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://eggs-experriment.com\",\n \"filters\": [\n {\n \"filter_id\": \"participant_group_allowlist\",\n \"selected_values\": [\n \"64514609c0265e1da4a74127\",\n \"64660e2e0ce5307750bf5c99\"\n ]\n }\n ],\n \"internal_name\": \"Study with multiple participant groups\",\n \"name\": \"Example where a participant can be in either participant group\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\n}" response = http.request(request) puts response.read_body ``` ```java multiple_participant_groups_either_or HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n }\n ],\n \"description\": \"A participant can be in either of these groups to gain study access\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://eggs-experriment.com\",\n \"filters\": [\n {\n \"filter_id\": \"participant_group_allowlist\",\n \"selected_values\": [\n \"64514609c0265e1da4a74127\",\n \"64660e2e0ce5307750bf5c99\"\n ]\n }\n ],\n \"internal_name\": \"Study with multiple participant groups\",\n \"name\": \"Example where a participant can be in either participant group\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\n}") .asString(); ``` ```php multiple_participant_groups_either_or request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [ { "action": "AUTOMATICALLY_APPROVE" } ] } ], "description": "A participant can be in either of these groups to gain study access", "device_compatibility": [ "mobile", "desktop", "tablet" ], "estimated_completion_time": 1, "external_study_url": "https://eggs-experriment.com", "filters": [ { "filter_id": "participant_group_allowlist", "selected_values": [ "64514609c0265e1da4a74127", "64660e2e0ce5307750bf5c99" ] } ], "internal_name": "Study with multiple participant groups", "name": "Example where a participant can be in either participant group", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 100, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 30 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp multiple_participant_groups_either_or var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n }\n ],\n \"description\": \"A participant can be in either of these groups to gain study access\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://eggs-experriment.com\",\n \"filters\": [\n {\n \"filter_id\": \"participant_group_allowlist\",\n \"selected_values\": [\n \"64514609c0265e1da4a74127\",\n \"64660e2e0ce5307750bf5c99\"\n ]\n }\n ],\n \"internal_name\": \"Study with multiple participant groups\",\n \"name\": \"Example where a participant can be in either participant group\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift multiple_participant_groups_either_or import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "completion_codes": [ [ "code": "ABC123", "code_type": "COMPLETED", "actions": [["action": "AUTOMATICALLY_APPROVE"]] ] ], "description": "A participant can be in either of these groups to gain study access", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://eggs-experriment.com", "filters": [ [ "filter_id": "participant_group_allowlist", "selected_values": ["64514609c0265e1da4a74127", "64660e2e0ce5307750bf5c99"] ] ], "internal_name": "Study with multiple participant groups", "name": "Example where a participant can be in either participant group", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 100, "submissions_config": ["max_submissions_per_participant": 1], "total_available_places": 30 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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 multiple_participant_groups_exclusive_to_both import requests url = "https://api.prolific.com/api/v1/studies/" payload = { "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [{ "action": "AUTOMATICALLY_APPROVE" }] } ], "description": "A participant has to be in both groups to gain study access", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://eggs-experriment.com", "filters": [ { "filter_id": "participant_group_allowlist", "selected_values": ["64514609c0265e1da4a74127"] }, { "filter_id": "participant_group_allowlist", "selected_values": ["64660e2e0ce5307750bf5c99"] } ], "internal_name": "Study with multiple participant groups", "name": "Example where a participant has to be in both participant groups", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 100, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 30 } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript multiple_participant_groups_exclusive_to_both const url = 'https://api.prolific.com/api/v1/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"completion_codes":[{"code":"ABC123","code_type":"COMPLETED","actions":[{"action":"AUTOMATICALLY_APPROVE"}]}],"description":"A participant has to be in both groups to gain study access","device_compatibility":["mobile","desktop","tablet"],"estimated_completion_time":1,"external_study_url":"https://eggs-experriment.com","filters":[{"filter_id":"participant_group_allowlist","selected_values":["64514609c0265e1da4a74127"]},{"filter_id":"participant_group_allowlist","selected_values":["64660e2e0ce5307750bf5c99"]}],"internal_name":"Study with multiple participant groups","name":"Example where a participant has to be in both participant groups","peripheral_requirements":[],"prolific_id_option":"question","reward":100,"submissions_config":{"max_submissions_per_participant":1},"total_available_places":30}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go multiple_participant_groups_exclusive_to_both package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/studies/" payload := strings.NewReader("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n }\n ],\n \"description\": \"A participant has to be in both groups to gain study access\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://eggs-experriment.com\",\n \"filters\": [\n {\n \"filter_id\": \"participant_group_allowlist\",\n \"selected_values\": [\n \"64514609c0265e1da4a74127\"\n ]\n },\n {\n \"filter_id\": \"participant_group_allowlist\",\n \"selected_values\": [\n \"64660e2e0ce5307750bf5c99\"\n ]\n }\n ],\n \"internal_name\": \"Study with multiple participant groups\",\n \"name\": \"Example where a participant has to be in both participant groups\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\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 multiple_participant_groups_exclusive_to_both require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/studies/") 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 \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n }\n ],\n \"description\": \"A participant has to be in both groups to gain study access\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://eggs-experriment.com\",\n \"filters\": [\n {\n \"filter_id\": \"participant_group_allowlist\",\n \"selected_values\": [\n \"64514609c0265e1da4a74127\"\n ]\n },\n {\n \"filter_id\": \"participant_group_allowlist\",\n \"selected_values\": [\n \"64660e2e0ce5307750bf5c99\"\n ]\n }\n ],\n \"internal_name\": \"Study with multiple participant groups\",\n \"name\": \"Example where a participant has to be in both participant groups\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\n}" response = http.request(request) puts response.read_body ``` ```java multiple_participant_groups_exclusive_to_both HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n }\n ],\n \"description\": \"A participant has to be in both groups to gain study access\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://eggs-experriment.com\",\n \"filters\": [\n {\n \"filter_id\": \"participant_group_allowlist\",\n \"selected_values\": [\n \"64514609c0265e1da4a74127\"\n ]\n },\n {\n \"filter_id\": \"participant_group_allowlist\",\n \"selected_values\": [\n \"64660e2e0ce5307750bf5c99\"\n ]\n }\n ],\n \"internal_name\": \"Study with multiple participant groups\",\n \"name\": \"Example where a participant has to be in both participant groups\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\n}") .asString(); ``` ```php multiple_participant_groups_exclusive_to_both request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [ { "action": "AUTOMATICALLY_APPROVE" } ] } ], "description": "A participant has to be in both groups to gain study access", "device_compatibility": [ "mobile", "desktop", "tablet" ], "estimated_completion_time": 1, "external_study_url": "https://eggs-experriment.com", "filters": [ { "filter_id": "participant_group_allowlist", "selected_values": [ "64514609c0265e1da4a74127" ] }, { "filter_id": "participant_group_allowlist", "selected_values": [ "64660e2e0ce5307750bf5c99" ] } ], "internal_name": "Study with multiple participant groups", "name": "Example where a participant has to be in both participant groups", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 100, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 30 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp multiple_participant_groups_exclusive_to_both var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n }\n ],\n \"description\": \"A participant has to be in both groups to gain study access\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://eggs-experriment.com\",\n \"filters\": [\n {\n \"filter_id\": \"participant_group_allowlist\",\n \"selected_values\": [\n \"64514609c0265e1da4a74127\"\n ]\n },\n {\n \"filter_id\": \"participant_group_allowlist\",\n \"selected_values\": [\n \"64660e2e0ce5307750bf5c99\"\n ]\n }\n ],\n \"internal_name\": \"Study with multiple participant groups\",\n \"name\": \"Example where a participant has to be in both participant groups\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift multiple_participant_groups_exclusive_to_both import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "completion_codes": [ [ "code": "ABC123", "code_type": "COMPLETED", "actions": [["action": "AUTOMATICALLY_APPROVE"]] ] ], "description": "A participant has to be in both groups to gain study access", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://eggs-experriment.com", "filters": [ [ "filter_id": "participant_group_allowlist", "selected_values": ["64514609c0265e1da4a74127"] ], [ "filter_id": "participant_group_allowlist", "selected_values": ["64660e2e0ce5307750bf5c99"] ] ], "internal_name": "Study with multiple participant groups", "name": "Example where a participant has to be in both participant groups", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 100, "submissions_config": ["max_submissions_per_participant": 1], "total_available_places": 30 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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 multi_submission_study import requests url = "https://api.prolific.com/api/v1/studies/" payload = { "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [{ "action": "AUTOMATICALLY_APPROVE" }] } ], "description": "Allow a participant to have multiple submissions up to 10 on the study", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [], "name": "A multiple submission study", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 13, "submissions_config": { "max_submissions_per_participant": 10 }, "total_available_places": 500 } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript multi_submission_study const url = 'https://api.prolific.com/api/v1/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"completion_codes":[{"code":"ABC123","code_type":"COMPLETED","actions":[{"action":"AUTOMATICALLY_APPROVE"}]}],"description":"Allow a participant to have multiple submissions up to 10 on the study","device_compatibility":["mobile","desktop","tablet"],"estimated_completion_time":1,"external_study_url":"https://google.com","filters":[],"name":"A multiple submission study","peripheral_requirements":[],"prolific_id_option":"question","reward":13,"submissions_config":{"max_submissions_per_participant":10},"total_available_places":500}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go multi_submission_study package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/studies/" payload := strings.NewReader("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n }\n ],\n \"description\": \"Allow a participant to have multiple submissions up to 10 on the study\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [],\n \"name\": \"A multiple submission study\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 10\n },\n \"total_available_places\": 500\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 multi_submission_study require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/studies/") 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 \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n }\n ],\n \"description\": \"Allow a participant to have multiple submissions up to 10 on the study\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [],\n \"name\": \"A multiple submission study\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 10\n },\n \"total_available_places\": 500\n}" response = http.request(request) puts response.read_body ``` ```java multi_submission_study HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n }\n ],\n \"description\": \"Allow a participant to have multiple submissions up to 10 on the study\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [],\n \"name\": \"A multiple submission study\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 10\n },\n \"total_available_places\": 500\n}") .asString(); ``` ```php multi_submission_study request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [ { "action": "AUTOMATICALLY_APPROVE" } ] } ], "description": "Allow a participant to have multiple submissions up to 10 on the study", "device_compatibility": [ "mobile", "desktop", "tablet" ], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [], "name": "A multiple submission study", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 13, "submissions_config": { "max_submissions_per_participant": 10 }, "total_available_places": 500 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp multi_submission_study var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n }\n ],\n \"description\": \"Allow a participant to have multiple submissions up to 10 on the study\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [],\n \"name\": \"A multiple submission study\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 10\n },\n \"total_available_places\": 500\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift multi_submission_study import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "completion_codes": [ [ "code": "ABC123", "code_type": "COMPLETED", "actions": [["action": "AUTOMATICALLY_APPROVE"]] ] ], "description": "Allow a participant to have multiple submissions up to 10 on the study", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [], "name": "A multiple submission study", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 13, "submissions_config": ["max_submissions_per_participant": 10], "total_available_places": 500 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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 study_with_select_filters import requests url = "https://api.prolific.com/api/v1/studies/" payload = { "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [{ "action": "MANUALLY_REVIEW" }] } ], "description": "test", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [ { "filter_id": "handedness", "selected_values": ["2"] } ], "name": "Test", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 13, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 500 } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript study_with_select_filters const url = 'https://api.prolific.com/api/v1/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"completion_codes":[{"code":"ABC123","code_type":"COMPLETED","actions":[{"action":"MANUALLY_REVIEW"}]}],"description":"test","device_compatibility":["mobile","desktop","tablet"],"estimated_completion_time":1,"external_study_url":"https://google.com","filters":[{"filter_id":"handedness","selected_values":["2"]}],"name":"Test","peripheral_requirements":[],"prolific_id_option":"question","reward":13,"submissions_config":{"max_submissions_per_participant":1},"total_available_places":500}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go study_with_select_filters package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/studies/" payload := strings.NewReader("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [\n {\n \"filter_id\": \"handedness\",\n \"selected_values\": [\n \"2\"\n ]\n }\n ],\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\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 study_with_select_filters require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/studies/") 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 \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [\n {\n \"filter_id\": \"handedness\",\n \"selected_values\": [\n \"2\"\n ]\n }\n ],\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}" response = http.request(request) puts response.read_body ``` ```java study_with_select_filters HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [\n {\n \"filter_id\": \"handedness\",\n \"selected_values\": [\n \"2\"\n ]\n }\n ],\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}") .asString(); ``` ```php study_with_select_filters request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [ { "action": "MANUALLY_REVIEW" } ] } ], "description": "test", "device_compatibility": [ "mobile", "desktop", "tablet" ], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [ { "filter_id": "handedness", "selected_values": [ "2" ] } ], "name": "Test", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 13, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 500 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp study_with_select_filters var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [\n {\n \"filter_id\": \"handedness\",\n \"selected_values\": [\n \"2\"\n ]\n }\n ],\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift study_with_select_filters import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "completion_codes": [ [ "code": "ABC123", "code_type": "COMPLETED", "actions": [["action": "MANUALLY_REVIEW"]] ] ], "description": "test", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [ [ "filter_id": "handedness", "selected_values": ["2"] ] ], "name": "Test", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 13, "submissions_config": ["max_submissions_per_participant": 1], "total_available_places": 500 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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 study_with_range_filters import requests url = "https://api.prolific.com/api/v1/studies/" payload = { "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [{ "action": "MANUALLY_REVIEW" }] } ], "description": "test", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [ { "filter_id": "age", "selected_range": { "lower": 18, "upper": 19 } } ], "name": "Test", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 13, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 500 } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript study_with_range_filters const url = 'https://api.prolific.com/api/v1/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"completion_codes":[{"code":"ABC123","code_type":"COMPLETED","actions":[{"action":"MANUALLY_REVIEW"}]}],"description":"test","device_compatibility":["mobile","desktop","tablet"],"estimated_completion_time":1,"external_study_url":"https://google.com","filters":[{"filter_id":"age","selected_range":{"lower":18,"upper":19}}],"name":"Test","peripheral_requirements":[],"prolific_id_option":"question","reward":13,"submissions_config":{"max_submissions_per_participant":1},"total_available_places":500}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go study_with_range_filters package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/studies/" payload := strings.NewReader("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [\n {\n \"filter_id\": \"age\",\n \"selected_range\": {\n \"lower\": 18,\n \"upper\": 19\n }\n }\n ],\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\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 study_with_range_filters require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/studies/") 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 \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [\n {\n \"filter_id\": \"age\",\n \"selected_range\": {\n \"lower\": 18,\n \"upper\": 19\n }\n }\n ],\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}" response = http.request(request) puts response.read_body ``` ```java study_with_range_filters HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [\n {\n \"filter_id\": \"age\",\n \"selected_range\": {\n \"lower\": 18,\n \"upper\": 19\n }\n }\n ],\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}") .asString(); ``` ```php study_with_range_filters request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [ { "action": "MANUALLY_REVIEW" } ] } ], "description": "test", "device_compatibility": [ "mobile", "desktop", "tablet" ], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [ { "filter_id": "age", "selected_range": { "lower": 18, "upper": 19 } } ], "name": "Test", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 13, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 500 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp study_with_range_filters var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [\n {\n \"filter_id\": \"age\",\n \"selected_range\": {\n \"lower\": 18,\n \"upper\": 19\n }\n }\n ],\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift study_with_range_filters import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "completion_codes": [ [ "code": "ABC123", "code_type": "COMPLETED", "actions": [["action": "MANUALLY_REVIEW"]] ] ], "description": "test", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [ [ "filter_id": "age", "selected_range": [ "lower": 18, "upper": 19 ] ] ], "name": "Test", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 13, "submissions_config": ["max_submissions_per_participant": 1], "total_available_places": 500 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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 study_with_filter_set import requests url = "https://api.prolific.com/api/v1/studies/" payload = { "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [{ "action": "MANUALLY_REVIEW" }] } ], "description": "test", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filter_set_id": "644b9cace850cb37684f0892", "name": "Test", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 13, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 500 } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript study_with_filter_set const url = 'https://api.prolific.com/api/v1/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"completion_codes":[{"code":"ABC123","code_type":"COMPLETED","actions":[{"action":"MANUALLY_REVIEW"}]}],"description":"test","device_compatibility":["mobile","desktop","tablet"],"estimated_completion_time":1,"external_study_url":"https://google.com","filter_set_id":"644b9cace850cb37684f0892","name":"Test","peripheral_requirements":[],"prolific_id_option":"question","reward":13,"submissions_config":{"max_submissions_per_participant":1},"total_available_places":500}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go study_with_filter_set package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/studies/" payload := strings.NewReader("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filter_set_id\": \"644b9cace850cb37684f0892\",\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\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 study_with_filter_set require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/studies/") 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 \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filter_set_id\": \"644b9cace850cb37684f0892\",\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}" response = http.request(request) puts response.read_body ``` ```java study_with_filter_set HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filter_set_id\": \"644b9cace850cb37684f0892\",\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}") .asString(); ``` ```php study_with_filter_set request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [ { "action": "MANUALLY_REVIEW" } ] } ], "description": "test", "device_compatibility": [ "mobile", "desktop", "tablet" ], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filter_set_id": "644b9cace850cb37684f0892", "name": "Test", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 13, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 500 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp study_with_filter_set var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filter_set_id\": \"644b9cace850cb37684f0892\",\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift study_with_filter_set import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "completion_codes": [ [ "code": "ABC123", "code_type": "COMPLETED", "actions": [["action": "MANUALLY_REVIEW"]] ] ], "description": "test", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filter_set_id": "644b9cace850cb37684f0892", "name": "Test", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 13, "submissions_config": ["max_submissions_per_participant": 1], "total_available_places": 500 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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 study_with_weighted_filters import requests url = "https://api.prolific.com/api/v1/studies/" payload = { "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [{ "action": "MANUALLY_REVIEW" }] } ], "description": "test", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [ { "filter_id": "handedness", "selected_values": ["1", "2"], "weightings": { "0": 1, "1": 1 } } ], "name": "Test", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 13, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 500 } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript study_with_weighted_filters const url = 'https://api.prolific.com/api/v1/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"completion_codes":[{"code":"ABC123","code_type":"COMPLETED","actions":[{"action":"MANUALLY_REVIEW"}]}],"description":"test","device_compatibility":["mobile","desktop","tablet"],"estimated_completion_time":1,"external_study_url":"https://google.com","filters":[{"filter_id":"handedness","selected_values":["1","2"],"weightings":{"0":1,"1":1}}],"name":"Test","peripheral_requirements":[],"prolific_id_option":"question","reward":13,"submissions_config":{"max_submissions_per_participant":1},"total_available_places":500}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go study_with_weighted_filters package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/studies/" payload := strings.NewReader("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [\n {\n \"filter_id\": \"handedness\",\n \"selected_values\": [\n \"1\",\n \"2\"\n ],\n \"weightings\": {\n \"0\": 1,\n \"1\": 1\n }\n }\n ],\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\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 study_with_weighted_filters require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/studies/") 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 \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [\n {\n \"filter_id\": \"handedness\",\n \"selected_values\": [\n \"1\",\n \"2\"\n ],\n \"weightings\": {\n \"0\": 1,\n \"1\": 1\n }\n }\n ],\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}" response = http.request(request) puts response.read_body ``` ```java study_with_weighted_filters HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [\n {\n \"filter_id\": \"handedness\",\n \"selected_values\": [\n \"1\",\n \"2\"\n ],\n \"weightings\": {\n \"0\": 1,\n \"1\": 1\n }\n }\n ],\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}") .asString(); ``` ```php study_with_weighted_filters request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [ { "action": "MANUALLY_REVIEW" } ] } ], "description": "test", "device_compatibility": [ "mobile", "desktop", "tablet" ], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [ { "filter_id": "handedness", "selected_values": [ "1", "2" ], "weightings": { "0": 1, "1": 1 } } ], "name": "Test", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 13, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 500 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp study_with_weighted_filters var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [\n {\n \"filter_id\": \"handedness\",\n \"selected_values\": [\n \"1\",\n \"2\"\n ],\n \"weightings\": {\n \"0\": 1,\n \"1\": 1\n }\n }\n ],\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift study_with_weighted_filters import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "completion_codes": [ [ "code": "ABC123", "code_type": "COMPLETED", "actions": [["action": "MANUALLY_REVIEW"]] ] ], "description": "test", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [ [ "filter_id": "handedness", "selected_values": ["1", "2"], "weightings": [ "0": 1, "1": 1 ] ] ], "name": "Test", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 13, "submissions_config": ["max_submissions_per_participant": 1], "total_available_places": 500 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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 study_with_age_range_weighted_filters import requests url = "https://api.prolific.com/api/v1/studies/" payload = { "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [{ "action": "MANUALLY_REVIEW" }] } ], "description": "test", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [ { "filter_id": "age", "selected_values": ["string"], "weightings": { "0": { "selected_range": { "lower": 18, "upper": 25 }, "weighting": 1 }, "1": { "selected_range": { "lower": 26, "upper": 35 }, "weighting": 1 }, "2": { "selected_range": { "lower": 36, "upper": 50 }, "weighting": 1 } } } ], "name": "Test", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 13, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 500 } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript study_with_age_range_weighted_filters const url = 'https://api.prolific.com/api/v1/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"completion_codes":[{"code":"ABC123","code_type":"COMPLETED","actions":[{"action":"MANUALLY_REVIEW"}]}],"description":"test","device_compatibility":["mobile","desktop","tablet"],"estimated_completion_time":1,"external_study_url":"https://google.com","filters":[{"filter_id":"age","selected_values":["string"],"weightings":{"0":{"selected_range":{"lower":18,"upper":25},"weighting":1},"1":{"selected_range":{"lower":26,"upper":35},"weighting":1},"2":{"selected_range":{"lower":36,"upper":50},"weighting":1}}}],"name":"Test","peripheral_requirements":[],"prolific_id_option":"question","reward":13,"submissions_config":{"max_submissions_per_participant":1},"total_available_places":500}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go study_with_age_range_weighted_filters package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/studies/" payload := strings.NewReader("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [\n {\n \"filter_id\": \"age\",\n \"selected_values\": [\n \"string\"\n ],\n \"weightings\": {\n \"0\": {\n \"selected_range\": {\n \"lower\": 18,\n \"upper\": 25\n },\n \"weighting\": 1\n },\n \"1\": {\n \"selected_range\": {\n \"lower\": 26,\n \"upper\": 35\n },\n \"weighting\": 1\n },\n \"2\": {\n \"selected_range\": {\n \"lower\": 36,\n \"upper\": 50\n },\n \"weighting\": 1\n }\n }\n }\n ],\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\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 study_with_age_range_weighted_filters require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/studies/") 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 \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [\n {\n \"filter_id\": \"age\",\n \"selected_values\": [\n \"string\"\n ],\n \"weightings\": {\n \"0\": {\n \"selected_range\": {\n \"lower\": 18,\n \"upper\": 25\n },\n \"weighting\": 1\n },\n \"1\": {\n \"selected_range\": {\n \"lower\": 26,\n \"upper\": 35\n },\n \"weighting\": 1\n },\n \"2\": {\n \"selected_range\": {\n \"lower\": 36,\n \"upper\": 50\n },\n \"weighting\": 1\n }\n }\n }\n ],\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}" response = http.request(request) puts response.read_body ``` ```java study_with_age_range_weighted_filters HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [\n {\n \"filter_id\": \"age\",\n \"selected_values\": [\n \"string\"\n ],\n \"weightings\": {\n \"0\": {\n \"selected_range\": {\n \"lower\": 18,\n \"upper\": 25\n },\n \"weighting\": 1\n },\n \"1\": {\n \"selected_range\": {\n \"lower\": 26,\n \"upper\": 35\n },\n \"weighting\": 1\n },\n \"2\": {\n \"selected_range\": {\n \"lower\": 36,\n \"upper\": 50\n },\n \"weighting\": 1\n }\n }\n }\n ],\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}") .asString(); ``` ```php study_with_age_range_weighted_filters request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [ { "action": "MANUALLY_REVIEW" } ] } ], "description": "test", "device_compatibility": [ "mobile", "desktop", "tablet" ], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [ { "filter_id": "age", "selected_values": [ "string" ], "weightings": { "0": { "selected_range": { "lower": 18, "upper": 25 }, "weighting": 1 }, "1": { "selected_range": { "lower": 26, "upper": 35 }, "weighting": 1 }, "2": { "selected_range": { "lower": 36, "upper": 50 }, "weighting": 1 } } } ], "name": "Test", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 13, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 500 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp study_with_age_range_weighted_filters var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [\n {\n \"filter_id\": \"age\",\n \"selected_values\": [\n \"string\"\n ],\n \"weightings\": {\n \"0\": {\n \"selected_range\": {\n \"lower\": 18,\n \"upper\": 25\n },\n \"weighting\": 1\n },\n \"1\": {\n \"selected_range\": {\n \"lower\": 26,\n \"upper\": 35\n },\n \"weighting\": 1\n },\n \"2\": {\n \"selected_range\": {\n \"lower\": 36,\n \"upper\": 50\n },\n \"weighting\": 1\n }\n }\n }\n ],\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift study_with_age_range_weighted_filters import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "completion_codes": [ [ "code": "ABC123", "code_type": "COMPLETED", "actions": [["action": "MANUALLY_REVIEW"]] ] ], "description": "test", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [ [ "filter_id": "age", "selected_values": ["string"], "weightings": [ "0": [ "selected_range": [ "lower": 18, "upper": 25 ], "weighting": 1 ], "1": [ "selected_range": [ "lower": 26, "upper": 35 ], "weighting": 1 ], "2": [ "selected_range": [ "lower": 36, "upper": 50 ], "weighting": 1 ] ] ] ], "name": "Test", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 13, "submissions_config": ["max_submissions_per_participant": 1], "total_available_places": 500 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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 study_labelled_as_interview import requests url = "https://api.prolific.com/api/v1/studies/" payload = { "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [{ "action": "MANUALLY_REVIEW" }] } ], "description": "In this study you will join a video call where we'll ask you some questions.", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [], "name": "Video Interview", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 100, "study_labels": ["interview"], "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 500 } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript study_labelled_as_interview const url = 'https://api.prolific.com/api/v1/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"completion_codes":[{"code":"ABC123","code_type":"COMPLETED","actions":[{"action":"MANUALLY_REVIEW"}]}],"description":"In this study you will join a video call where we\'ll ask you some questions.","device_compatibility":["mobile","desktop","tablet"],"estimated_completion_time":1,"external_study_url":"https://google.com","filters":[],"name":"Video Interview","peripheral_requirements":[],"prolific_id_option":"question","reward":100,"study_labels":["interview"],"submissions_config":{"max_submissions_per_participant":1},"total_available_places":500}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go study_labelled_as_interview package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/studies/" payload := strings.NewReader("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"In this study you will join a video call where we'll ask you some questions.\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [],\n \"name\": \"Video Interview\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 100,\n \"study_labels\": [\n \"interview\"\n ],\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\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 study_labelled_as_interview require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/studies/") 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 \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"In this study you will join a video call where we'll ask you some questions.\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [],\n \"name\": \"Video Interview\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 100,\n \"study_labels\": [\n \"interview\"\n ],\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}" response = http.request(request) puts response.read_body ``` ```java study_labelled_as_interview HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"In this study you will join a video call where we'll ask you some questions.\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [],\n \"name\": \"Video Interview\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 100,\n \"study_labels\": [\n \"interview\"\n ],\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}") .asString(); ``` ```php study_labelled_as_interview request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [ { "action": "MANUALLY_REVIEW" } ] } ], "description": "In this study you will join a video call where we\'ll ask you some questions.", "device_compatibility": [ "mobile", "desktop", "tablet" ], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [], "name": "Video Interview", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 100, "study_labels": [ "interview" ], "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 500 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp study_labelled_as_interview var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"In this study you will join a video call where we'll ask you some questions.\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [],\n \"name\": \"Video Interview\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 100,\n \"study_labels\": [\n \"interview\"\n ],\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift study_labelled_as_interview import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "completion_codes": [ [ "code": "ABC123", "code_type": "COMPLETED", "actions": [["action": "MANUALLY_REVIEW"]] ] ], "description": "In this study you will join a video call where we'll ask you some questions.", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [], "name": "Video Interview", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 100, "study_labels": ["interview"], "submissions_config": ["max_submissions_per_participant": 1], "total_available_places": 500 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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 study_with_taskflow import requests url = "https://api.prolific.com/api/v1/studies/" payload = { "access_details": [ { "external_url": "https://google.com", "total_allocation": 20 }, { "external_url": "https://bing.com", "total_allocation": 20 }, { "external_url": "https://yahoo.com", "total_allocation": 10 } ], "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [{ "action": "MANUALLY_REVIEW" }] } ], "description": "test", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "name": "Test", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 10, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 50 } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript study_with_taskflow const url = 'https://api.prolific.com/api/v1/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"access_details":[{"external_url":"https://google.com","total_allocation":20},{"external_url":"https://bing.com","total_allocation":20},{"external_url":"https://yahoo.com","total_allocation":10}],"completion_codes":[{"code":"ABC123","code_type":"COMPLETED","actions":[{"action":"MANUALLY_REVIEW"}]}],"description":"test","device_compatibility":["mobile","desktop","tablet"],"estimated_completion_time":1,"name":"Test","peripheral_requirements":[],"prolific_id_option":"question","reward":10,"submissions_config":{"max_submissions_per_participant":1},"total_available_places":50}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go study_with_taskflow package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/studies/" payload := strings.NewReader("{\n \"access_details\": [\n {\n \"external_url\": \"https://google.com\",\n \"total_allocation\": 20\n },\n {\n \"external_url\": \"https://bing.com\",\n \"total_allocation\": 20\n },\n {\n \"external_url\": \"https://yahoo.com\",\n \"total_allocation\": 10\n }\n ],\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 10,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 50\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 study_with_taskflow require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/studies/") 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 \"access_details\": [\n {\n \"external_url\": \"https://google.com\",\n \"total_allocation\": 20\n },\n {\n \"external_url\": \"https://bing.com\",\n \"total_allocation\": 20\n },\n {\n \"external_url\": \"https://yahoo.com\",\n \"total_allocation\": 10\n }\n ],\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 10,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 50\n}" response = http.request(request) puts response.read_body ``` ```java study_with_taskflow HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"access_details\": [\n {\n \"external_url\": \"https://google.com\",\n \"total_allocation\": 20\n },\n {\n \"external_url\": \"https://bing.com\",\n \"total_allocation\": 20\n },\n {\n \"external_url\": \"https://yahoo.com\",\n \"total_allocation\": 10\n }\n ],\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 10,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 50\n}") .asString(); ``` ```php study_with_taskflow request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "access_details": [ { "external_url": "https://google.com", "total_allocation": 20 }, { "external_url": "https://bing.com", "total_allocation": 20 }, { "external_url": "https://yahoo.com", "total_allocation": 10 } ], "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [ { "action": "MANUALLY_REVIEW" } ] } ], "description": "test", "device_compatibility": [ "mobile", "desktop", "tablet" ], "estimated_completion_time": 1, "name": "Test", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 10, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 50 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp study_with_taskflow var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"access_details\": [\n {\n \"external_url\": \"https://google.com\",\n \"total_allocation\": 20\n },\n {\n \"external_url\": \"https://bing.com\",\n \"total_allocation\": 20\n },\n {\n \"external_url\": \"https://yahoo.com\",\n \"total_allocation\": 10\n }\n ],\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"test\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"name\": \"Test\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 10,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 50\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift study_with_taskflow import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "access_details": [ [ "external_url": "https://google.com", "total_allocation": 20 ], [ "external_url": "https://bing.com", "total_allocation": 20 ], [ "external_url": "https://yahoo.com", "total_allocation": 10 ] ], "completion_codes": [ [ "code": "ABC123", "code_type": "COMPLETED", "actions": [["action": "MANUALLY_REVIEW"]] ] ], "description": "test", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "name": "Test", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 10, "submissions_config": ["max_submissions_per_participant": 1], "total_available_places": 50 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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 study_with_custom_group import requests url = "https://api.prolific.com/api/v1/studies/" payload = { "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [{ "action": "MANUALLY_REVIEW" }] } ], "description": "A survey for Javascript developers", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://example.com/study", "filters": [ { "filter_id": "javascript", "selected_values": ["0"] } ], "name": "Programming Survey", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 13, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 500 } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript study_with_custom_group const url = 'https://api.prolific.com/api/v1/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"completion_codes":[{"code":"ABC123","code_type":"COMPLETED","actions":[{"action":"MANUALLY_REVIEW"}]}],"description":"A survey for Javascript developers","device_compatibility":["mobile","desktop","tablet"],"estimated_completion_time":1,"external_study_url":"https://example.com/study","filters":[{"filter_id":"javascript","selected_values":["0"]}],"name":"Programming Survey","peripheral_requirements":[],"prolific_id_option":"question","reward":13,"submissions_config":{"max_submissions_per_participant":1},"total_available_places":500}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go study_with_custom_group package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/studies/" payload := strings.NewReader("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"A survey for Javascript developers\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://example.com/study\",\n \"filters\": [\n {\n \"filter_id\": \"javascript\",\n \"selected_values\": [\n \"0\"\n ]\n }\n ],\n \"name\": \"Programming Survey\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\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 study_with_custom_group require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/studies/") 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 \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"A survey for Javascript developers\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://example.com/study\",\n \"filters\": [\n {\n \"filter_id\": \"javascript\",\n \"selected_values\": [\n \"0\"\n ]\n }\n ],\n \"name\": \"Programming Survey\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}" response = http.request(request) puts response.read_body ``` ```java study_with_custom_group HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"A survey for Javascript developers\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://example.com/study\",\n \"filters\": [\n {\n \"filter_id\": \"javascript\",\n \"selected_values\": [\n \"0\"\n ]\n }\n ],\n \"name\": \"Programming Survey\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}") .asString(); ``` ```php study_with_custom_group request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [ { "action": "MANUALLY_REVIEW" } ] } ], "description": "A survey for Javascript developers", "device_compatibility": [ "mobile", "desktop", "tablet" ], "estimated_completion_time": 1, "external_study_url": "https://example.com/study", "filters": [ { "filter_id": "javascript", "selected_values": [ "0" ] } ], "name": "Programming Survey", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 13, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 500 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp study_with_custom_group var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"A survey for Javascript developers\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://example.com/study\",\n \"filters\": [\n {\n \"filter_id\": \"javascript\",\n \"selected_values\": [\n \"0\"\n ]\n }\n ],\n \"name\": \"Programming Survey\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 13,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 500\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift study_with_custom_group import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "completion_codes": [ [ "code": "ABC123", "code_type": "COMPLETED", "actions": [["action": "MANUALLY_REVIEW"]] ] ], "description": "A survey for Javascript developers", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://example.com/study", "filters": [ [ "filter_id": "javascript", "selected_values": ["0"] ] ], "name": "Programming Survey", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 13, "submissions_config": ["max_submissions_per_participant": 1], "total_available_places": 500 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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 your_first_data_collection_study import requests url = "https://api.prolific.com/api/v1/studies/" payload = { "completion_codes": [ { "code": "STUDY_COMPLETED", "code_type": "COMPLETED", "actions": [{ "action": "MANUALLY_REVIEW" }] } ], "description": "A study using prolific surveys to collect data", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://prolific.com/surveys/{survey_id}", "filters": [ { "filter_id": "age", "selected_range": { "lower": 18, "upper": 35 } } ], "name": "Your First Data Collection Study", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 15, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 10 } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript your_first_data_collection_study const url = 'https://api.prolific.com/api/v1/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"completion_codes":[{"code":"STUDY_COMPLETED","code_type":"COMPLETED","actions":[{"action":"MANUALLY_REVIEW"}]}],"description":"A study using prolific surveys to collect data","device_compatibility":["mobile","desktop","tablet"],"estimated_completion_time":1,"external_study_url":"https://prolific.com/surveys/{survey_id}","filters":[{"filter_id":"age","selected_range":{"lower":18,"upper":35}}],"name":"Your First Data Collection Study","peripheral_requirements":[],"prolific_id_option":"question","reward":15,"submissions_config":{"max_submissions_per_participant":1},"total_available_places":10}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go your_first_data_collection_study package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/studies/" payload := strings.NewReader("{\n \"completion_codes\": [\n {\n \"code\": \"STUDY_COMPLETED\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"A study using prolific surveys to collect data\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://prolific.com/surveys/{survey_id}\",\n \"filters\": [\n {\n \"filter_id\": \"age\",\n \"selected_range\": {\n \"lower\": 18,\n \"upper\": 35\n }\n }\n ],\n \"name\": \"Your First Data Collection Study\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 15,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 10\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 your_first_data_collection_study require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/studies/") 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 \"completion_codes\": [\n {\n \"code\": \"STUDY_COMPLETED\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"A study using prolific surveys to collect data\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://prolific.com/surveys/{survey_id}\",\n \"filters\": [\n {\n \"filter_id\": \"age\",\n \"selected_range\": {\n \"lower\": 18,\n \"upper\": 35\n }\n }\n ],\n \"name\": \"Your First Data Collection Study\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 15,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 10\n}" response = http.request(request) puts response.read_body ``` ```java your_first_data_collection_study HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"completion_codes\": [\n {\n \"code\": \"STUDY_COMPLETED\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"A study using prolific surveys to collect data\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://prolific.com/surveys/{survey_id}\",\n \"filters\": [\n {\n \"filter_id\": \"age\",\n \"selected_range\": {\n \"lower\": 18,\n \"upper\": 35\n }\n }\n ],\n \"name\": \"Your First Data Collection Study\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 15,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 10\n}") .asString(); ``` ```php your_first_data_collection_study request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "completion_codes": [ { "code": "STUDY_COMPLETED", "code_type": "COMPLETED", "actions": [ { "action": "MANUALLY_REVIEW" } ] } ], "description": "A study using prolific surveys to collect data", "device_compatibility": [ "mobile", "desktop", "tablet" ], "estimated_completion_time": 1, "external_study_url": "https://prolific.com/surveys/{survey_id}", "filters": [ { "filter_id": "age", "selected_range": { "lower": 18, "upper": 35 } } ], "name": "Your First Data Collection Study", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 15, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 10 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp your_first_data_collection_study var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"completion_codes\": [\n {\n \"code\": \"STUDY_COMPLETED\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"A study using prolific surveys to collect data\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://prolific.com/surveys/{survey_id}\",\n \"filters\": [\n {\n \"filter_id\": \"age\",\n \"selected_range\": {\n \"lower\": 18,\n \"upper\": 35\n }\n }\n ],\n \"name\": \"Your First Data Collection Study\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 15,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 10\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift your_first_data_collection_study import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "completion_codes": [ [ "code": "STUDY_COMPLETED", "code_type": "COMPLETED", "actions": [["action": "MANUALLY_REVIEW"]] ] ], "description": "A study using prolific surveys to collect data", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://prolific.com/surveys/{survey_id}", "filters": [ [ "filter_id": "age", "selected_range": [ "lower": 18, "upper": 35 ] ] ], "name": "Your First Data Collection Study", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 15, "submissions_config": ["max_submissions_per_participant": 1], "total_available_places": 10 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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 study_with_auto_rejection import requests url = "https://api.prolific.com/api/v1/studies/" payload = { "completion_codes": [ { "code": "COMP123", "code_type": "COMPLETED", "actions": [{ "action": "MANUALLY_REVIEW" }] } ], "description": "A short survey about your experience with our app", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 5, "external_study_url": "https://example.com/survey", "filters": [], "name": "User Experience Survey", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 50, "submissions_config": { "max_submissions_per_participant": 1, "max_concurrent_submissions": -1, "auto_rejection_categories": ["EXCEPTIONALLY_FAST"] }, "total_available_places": 100 } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript study_with_auto_rejection const url = 'https://api.prolific.com/api/v1/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"completion_codes":[{"code":"COMP123","code_type":"COMPLETED","actions":[{"action":"MANUALLY_REVIEW"}]}],"description":"A short survey about your experience with our app","device_compatibility":["mobile","desktop","tablet"],"estimated_completion_time":5,"external_study_url":"https://example.com/survey","filters":[],"name":"User Experience Survey","peripheral_requirements":[],"prolific_id_option":"question","reward":50,"submissions_config":{"max_submissions_per_participant":1,"max_concurrent_submissions":-1,"auto_rejection_categories":["EXCEPTIONALLY_FAST"]},"total_available_places":100}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go study_with_auto_rejection package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/studies/" payload := strings.NewReader("{\n \"completion_codes\": [\n {\n \"code\": \"COMP123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"A short survey about your experience with our app\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://example.com/survey\",\n \"filters\": [],\n \"name\": \"User Experience Survey\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 50,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1,\n \"max_concurrent_submissions\": -1,\n \"auto_rejection_categories\": [\n \"EXCEPTIONALLY_FAST\"\n ]\n },\n \"total_available_places\": 100\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 study_with_auto_rejection require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/studies/") 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 \"completion_codes\": [\n {\n \"code\": \"COMP123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"A short survey about your experience with our app\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://example.com/survey\",\n \"filters\": [],\n \"name\": \"User Experience Survey\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 50,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1,\n \"max_concurrent_submissions\": -1,\n \"auto_rejection_categories\": [\n \"EXCEPTIONALLY_FAST\"\n ]\n },\n \"total_available_places\": 100\n}" response = http.request(request) puts response.read_body ``` ```java study_with_auto_rejection HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"completion_codes\": [\n {\n \"code\": \"COMP123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"A short survey about your experience with our app\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://example.com/survey\",\n \"filters\": [],\n \"name\": \"User Experience Survey\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 50,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1,\n \"max_concurrent_submissions\": -1,\n \"auto_rejection_categories\": [\n \"EXCEPTIONALLY_FAST\"\n ]\n },\n \"total_available_places\": 100\n}") .asString(); ``` ```php study_with_auto_rejection request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "completion_codes": [ { "code": "COMP123", "code_type": "COMPLETED", "actions": [ { "action": "MANUALLY_REVIEW" } ] } ], "description": "A short survey about your experience with our app", "device_compatibility": [ "mobile", "desktop", "tablet" ], "estimated_completion_time": 5, "external_study_url": "https://example.com/survey", "filters": [], "name": "User Experience Survey", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 50, "submissions_config": { "max_submissions_per_participant": 1, "max_concurrent_submissions": -1, "auto_rejection_categories": [ "EXCEPTIONALLY_FAST" ] }, "total_available_places": 100 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp study_with_auto_rejection var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"completion_codes\": [\n {\n \"code\": \"COMP123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"MANUALLY_REVIEW\"\n }\n ]\n }\n ],\n \"description\": \"A short survey about your experience with our app\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://example.com/survey\",\n \"filters\": [],\n \"name\": \"User Experience Survey\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 50,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1,\n \"max_concurrent_submissions\": -1,\n \"auto_rejection_categories\": [\n \"EXCEPTIONALLY_FAST\"\n ]\n },\n \"total_available_places\": 100\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift study_with_auto_rejection import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "completion_codes": [ [ "code": "COMP123", "code_type": "COMPLETED", "actions": [["action": "MANUALLY_REVIEW"]] ] ], "description": "A short survey about your experience with our app", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 5, "external_study_url": "https://example.com/survey", "filters": [], "name": "User Experience Survey", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 50, "submissions_config": [ "max_submissions_per_participant": 1, "max_concurrent_submissions": -1, "auto_rejection_categories": ["EXCEPTIONALLY_FAST"] ], "total_available_places": 100 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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 study_with_automatic_approval import requests url = "https://api.prolific.com/api/v1/studies/" payload = { "completion_codes": [ { "code": "K3C8R0", "code_type": "COMPLETED", "actions": [{ "action": "AUTOMATICALLY_APPROVE" }] } ], "description": "A short survey which submissions are automatically approved", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [], "name": "A study with automatic approval", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 160, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 10 } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript study_with_automatic_approval const url = 'https://api.prolific.com/api/v1/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"completion_codes":[{"code":"K3C8R0","code_type":"COMPLETED","actions":[{"action":"AUTOMATICALLY_APPROVE"}]}],"description":"A short survey which submissions are automatically approved","device_compatibility":["mobile","desktop","tablet"],"estimated_completion_time":1,"external_study_url":"https://google.com","filters":[],"name":"A study with automatic approval","peripheral_requirements":[],"prolific_id_option":"question","reward":160,"submissions_config":{"max_submissions_per_participant":1},"total_available_places":10}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go study_with_automatic_approval package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/studies/" payload := strings.NewReader("{\n \"completion_codes\": [\n {\n \"code\": \"K3C8R0\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n }\n ],\n \"description\": \"A short survey which submissions are automatically approved\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [],\n \"name\": \"A study with automatic approval\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 160,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 10\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 study_with_automatic_approval require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/studies/") 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 \"completion_codes\": [\n {\n \"code\": \"K3C8R0\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n }\n ],\n \"description\": \"A short survey which submissions are automatically approved\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [],\n \"name\": \"A study with automatic approval\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 160,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 10\n}" response = http.request(request) puts response.read_body ``` ```java study_with_automatic_approval HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"completion_codes\": [\n {\n \"code\": \"K3C8R0\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n }\n ],\n \"description\": \"A short survey which submissions are automatically approved\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [],\n \"name\": \"A study with automatic approval\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 160,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 10\n}") .asString(); ``` ```php study_with_automatic_approval request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "completion_codes": [ { "code": "K3C8R0", "code_type": "COMPLETED", "actions": [ { "action": "AUTOMATICALLY_APPROVE" } ] } ], "description": "A short survey which submissions are automatically approved", "device_compatibility": [ "mobile", "desktop", "tablet" ], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [], "name": "A study with automatic approval", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 160, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 10 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp study_with_automatic_approval var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"completion_codes\": [\n {\n \"code\": \"K3C8R0\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n }\n ],\n \"description\": \"A short survey which submissions are automatically approved\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [],\n \"name\": \"A study with automatic approval\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 160,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 10\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift study_with_automatic_approval import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "completion_codes": [ [ "code": "K3C8R0", "code_type": "COMPLETED", "actions": [["action": "AUTOMATICALLY_APPROVE"]] ] ], "description": "A short survey which submissions are automatically approved", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [], "name": "A study with automatic approval", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 160, "submissions_config": ["max_submissions_per_participant": 1], "total_available_places": 10 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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 study_with_custom_screening import requests url = "https://api.prolific.com/api/v1/studies/" payload = { "completion_codes": [ { "code": "M3J9OF", "code_type": "COMPLETED", "actions": [{ "action": "AUTOMATICALLY_APPROVE" }] }, { "code": "L7X9G4", "code_type": "COMPLETED", "actions": [ { "action": "FIXED_SCREEN_OUT_PAYMENT", "fixed_screen_out_reward": 150, "slots": 2 } ] } ], "description": "A short survey with in-study screening questions", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [], "name": "A study with custom screening", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 160, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 10 } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript study_with_custom_screening const url = 'https://api.prolific.com/api/v1/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"completion_codes":[{"code":"M3J9OF","code_type":"COMPLETED","actions":[{"action":"AUTOMATICALLY_APPROVE"}]},{"code":"L7X9G4","code_type":"COMPLETED","actions":[{"action":"FIXED_SCREEN_OUT_PAYMENT","fixed_screen_out_reward":150,"slots":2}]}],"description":"A short survey with in-study screening questions","device_compatibility":["mobile","desktop","tablet"],"estimated_completion_time":1,"external_study_url":"https://google.com","filters":[],"name":"A study with custom screening","peripheral_requirements":[],"prolific_id_option":"question","reward":160,"submissions_config":{"max_submissions_per_participant":1},"total_available_places":10}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go study_with_custom_screening package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/studies/" payload := strings.NewReader("{\n \"completion_codes\": [\n {\n \"code\": \"M3J9OF\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"L7X9G4\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"FIXED_SCREEN_OUT_PAYMENT\",\n \"fixed_screen_out_reward\": 150,\n \"slots\": 2\n }\n ]\n }\n ],\n \"description\": \"A short survey with in-study screening questions\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [],\n \"name\": \"A study with custom screening\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 160,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 10\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 study_with_custom_screening require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/studies/") 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 \"completion_codes\": [\n {\n \"code\": \"M3J9OF\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"L7X9G4\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"FIXED_SCREEN_OUT_PAYMENT\",\n \"fixed_screen_out_reward\": 150,\n \"slots\": 2\n }\n ]\n }\n ],\n \"description\": \"A short survey with in-study screening questions\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [],\n \"name\": \"A study with custom screening\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 160,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 10\n}" response = http.request(request) puts response.read_body ``` ```java study_with_custom_screening HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"completion_codes\": [\n {\n \"code\": \"M3J9OF\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"L7X9G4\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"FIXED_SCREEN_OUT_PAYMENT\",\n \"fixed_screen_out_reward\": 150,\n \"slots\": 2\n }\n ]\n }\n ],\n \"description\": \"A short survey with in-study screening questions\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [],\n \"name\": \"A study with custom screening\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 160,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 10\n}") .asString(); ``` ```php study_with_custom_screening request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "completion_codes": [ { "code": "M3J9OF", "code_type": "COMPLETED", "actions": [ { "action": "AUTOMATICALLY_APPROVE" } ] }, { "code": "L7X9G4", "code_type": "COMPLETED", "actions": [ { "action": "FIXED_SCREEN_OUT_PAYMENT", "fixed_screen_out_reward": 150, "slots": 2 } ] } ], "description": "A short survey with in-study screening questions", "device_compatibility": [ "mobile", "desktop", "tablet" ], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [], "name": "A study with custom screening", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 160, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 10 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp study_with_custom_screening var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"completion_codes\": [\n {\n \"code\": \"M3J9OF\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"L7X9G4\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"FIXED_SCREEN_OUT_PAYMENT\",\n \"fixed_screen_out_reward\": 150,\n \"slots\": 2\n }\n ]\n }\n ],\n \"description\": \"A short survey with in-study screening questions\",\n \"device_compatibility\": [\n \"mobile\",\n \"desktop\",\n \"tablet\"\n ],\n \"estimated_completion_time\": 1,\n \"external_study_url\": \"https://google.com\",\n \"filters\": [],\n \"name\": \"A study with custom screening\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"question\",\n \"reward\": 160,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 10\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift study_with_custom_screening import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "completion_codes": [ [ "code": "M3J9OF", "code_type": "COMPLETED", "actions": [["action": "AUTOMATICALLY_APPROVE"]] ], [ "code": "L7X9G4", "code_type": "COMPLETED", "actions": [ [ "action": "FIXED_SCREEN_OUT_PAYMENT", "fixed_screen_out_reward": 150, "slots": 2 ] ] ] ], "description": "A short survey with in-study screening questions", "device_compatibility": ["mobile", "desktop", "tablet"], "estimated_completion_time": 1, "external_study_url": "https://google.com", "filters": [], "name": "A study with custom screening", "peripheral_requirements": [], "prolific_id_option": "question", "reward": 160, "submissions_config": ["max_submissions_per_participant": 1], "total_available_places": 10 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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/studies/" payload = { "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [{ "action": "AUTOMATICALLY_APPROVE" }] }, { "code": "DEF234", "code_type": "FOLLOW_UP_STUDY", "actions": [ { "action": "AUTOMATICALLY_APPROVE" }, { "action": "ADD_TO_PARTICIPANT_GROUP", "participant_group": "619e049f7648a4e1f8f3645b" } ] } ], "description": "This study aims to determine how to make a good public API", "device_compatibility": ["desktop"], "estimated_completion_time": 5, "external_study_url": "https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}", "filters": [], "internal_name": "WIT-2021 Study about API's version 2", "name": "Study about API's", "peripheral_requirements": [], "prolific_id_option": "url_parameters", "reward": 100, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 30 } 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/studies/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"completion_codes":[{"code":"ABC123","code_type":"COMPLETED","actions":[{"action":"AUTOMATICALLY_APPROVE"}]},{"code":"DEF234","code_type":"FOLLOW_UP_STUDY","actions":[{"action":"AUTOMATICALLY_APPROVE"},{"action":"ADD_TO_PARTICIPANT_GROUP","participant_group":"619e049f7648a4e1f8f3645b"}]}],"description":"This study aims to determine how to make a good public API","device_compatibility":["desktop"],"estimated_completion_time":5,"external_study_url":"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}","filters":[],"internal_name":"WIT-2021 Study about API\'s version 2","name":"Study about API\'s","peripheral_requirements":[],"prolific_id_option":"url_parameters","reward":100,"submissions_config":{"max_submissions_per_participant":1},"total_available_places":30}' }; 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/studies/" payload := strings.NewReader("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"FOLLOW_UP_STUDY\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"This study aims to determine how to make a good public API\",\n \"device_compatibility\": [\n \"desktop\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"filters\": [],\n \"internal_name\": \"WIT-2021 Study about API's version 2\",\n \"name\": \"Study about API's\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\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/studies/") 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 \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"FOLLOW_UP_STUDY\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"This study aims to determine how to make a good public API\",\n \"device_compatibility\": [\n \"desktop\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"filters\": [],\n \"internal_name\": \"WIT-2021 Study about API's version 2\",\n \"name\": \"Study about API's\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\n}" response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/studies/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"FOLLOW_UP_STUDY\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"This study aims to determine how to make a good public API\",\n \"device_compatibility\": [\n \"desktop\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"filters\": [],\n \"internal_name\": \"WIT-2021 Study about API's version 2\",\n \"name\": \"Study about API's\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\n}") .asString(); ``` ```php request('POST', 'https://api.prolific.com/api/v1/studies/', [ 'body' => '{ "completion_codes": [ { "code": "ABC123", "code_type": "COMPLETED", "actions": [ { "action": "AUTOMATICALLY_APPROVE" } ] }, { "code": "DEF234", "code_type": "FOLLOW_UP_STUDY", "actions": [ { "action": "AUTOMATICALLY_APPROVE" }, { "action": "ADD_TO_PARTICIPANT_GROUP", "participant_group": "619e049f7648a4e1f8f3645b" } ] } ], "description": "This study aims to determine how to make a good public API", "device_compatibility": [ "desktop" ], "estimated_completion_time": 5, "external_study_url": "https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}", "filters": [], "internal_name": "WIT-2021 Study about API\'s version 2", "name": "Study about API\'s", "peripheral_requirements": [], "prolific_id_option": "url_parameters", "reward": 100, "submissions_config": { "max_submissions_per_participant": 1 }, "total_available_places": 30 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.prolific.com/api/v1/studies/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"completion_codes\": [\n {\n \"code\": \"ABC123\",\n \"code_type\": \"COMPLETED\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n }\n ]\n },\n {\n \"code\": \"DEF234\",\n \"code_type\": \"FOLLOW_UP_STUDY\",\n \"actions\": [\n {\n \"action\": \"AUTOMATICALLY_APPROVE\"\n },\n {\n \"action\": \"ADD_TO_PARTICIPANT_GROUP\",\n \"participant_group\": \"619e049f7648a4e1f8f3645b\"\n }\n ]\n }\n ],\n \"description\": \"This study aims to determine how to make a good public API\",\n \"device_compatibility\": [\n \"desktop\"\n ],\n \"estimated_completion_time\": 5,\n \"external_study_url\": \"https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}\",\n \"filters\": [],\n \"internal_name\": \"WIT-2021 Study about API's version 2\",\n \"name\": \"Study about API's\",\n \"peripheral_requirements\": [],\n \"prolific_id_option\": \"url_parameters\",\n \"reward\": 100,\n \"submissions_config\": {\n \"max_submissions_per_participant\": 1\n },\n \"total_available_places\": 30\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "completion_codes": [ [ "code": "ABC123", "code_type": "COMPLETED", "actions": [["action": "AUTOMATICALLY_APPROVE"]] ], [ "code": "DEF234", "code_type": "FOLLOW_UP_STUDY", "actions": [ ["action": "AUTOMATICALLY_APPROVE"], [ "action": "ADD_TO_PARTICIPANT_GROUP", "participant_group": "619e049f7648a4e1f8f3645b" ] ] ] ], "description": "This study aims to determine how to make a good public API", "device_compatibility": ["desktop"], "estimated_completion_time": 5, "external_study_url": "https://eggs-experriment.com?participant={{%PROLIFIC_PID%}}", "filters": [], "internal_name": "WIT-2021 Study about API's version 2", "name": "Study about API's", "peripheral_requirements": [], "prolific_id_option": "url_parameters", "reward": 100, "submissions_config": ["max_submissions_per_participant": 1], "total_available_places": 30 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/studies/")! 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() ```