|
11 | 11 | class Surveys(Base): |
12 | 12 | """Responsible for all API methods under 'Surveys' in the API Playground""" |
13 | 13 |
|
| 14 | + def export_survey_link( |
| 15 | + self, |
| 16 | + instrument: str, |
| 17 | + record: str, |
| 18 | + event: Optional[str] = None, |
| 19 | + repeat_instance: int = 1, |
| 20 | + ): |
| 21 | + """ |
| 22 | + Export one survey link |
| 23 | +
|
| 24 | + Note: |
| 25 | + The passed instrument must be set up as a survey instrument. |
| 26 | +
|
| 27 | + Args: |
| 28 | + instrument: |
| 29 | + Name of instrument as seen in the Data Dictionary (metadata). |
| 30 | + record: |
| 31 | + Name of the record |
| 32 | + event: |
| 33 | + Unique event name, only used in longitudinal projects |
| 34 | + repeat_instance: |
| 35 | + only for projects with repeating instruments/events) |
| 36 | + The repeat instance number of the repeating event (if longitudinal) |
| 37 | + or the repeating instrument (if classic or longitudinal). |
| 38 | + Default value is '1'. |
| 39 | +
|
| 40 | + Returns: |
| 41 | + Str: |
| 42 | + URL of survey link requested |
| 43 | +
|
| 44 | + Examples: |
| 45 | + >>> proj.export_survey_link(instrument="form_1", record="5", event="event_1_arm_1") |
| 46 | + https://redcap.mytld.com/surveys/?s=6B2zFAEWPVSrXnnx |
| 47 | + """ |
| 48 | + payload = self._initialize_payload( |
| 49 | + content="surveyLink" |
| 50 | + ) |
| 51 | + payload["instrument"] = instrument |
| 52 | + payload["record"] = record |
| 53 | + if event: |
| 54 | + payload["event"] = event |
| 55 | + payload["repeat_instance"] = repeat_instance |
| 56 | + |
| 57 | + return_type = "str" |
| 58 | + response = cast(Union[Json, str], self._call_api(payload, return_type)) |
| 59 | + |
| 60 | + return self._return_data( |
| 61 | + response=response, |
| 62 | + content="surveyLink", |
| 63 | + format_type=return_type, |
| 64 | + ) |
| 65 | + |
14 | 66 | def export_survey_participant_list( |
15 | 67 | self, |
16 | 68 | instrument: str, |
|
0 commit comments