====== Delete Data ====== The collected data can be deleted under **Collected data** -> **Delete collected data**. There are different variants, which are described below: * Automatic deletion through project archiving * Manual deletion of individual cases or all collected data * Timed deletion * Data deletion via API The data collected includes: * Questionnaire responses (interview, pretest, and questionnaire development) -- i.e., the actual data set. * Files uploaded or transferred by the participants by means of corresponding question types * Notes from the pretest The following data is subject to other storage and deletion mechanisms: * Separately collected contact data ([[:en:create:questions:contact]]) * Address data for sending serial mails ([[:en:create:questions:opt-in]], [[:en:survey:mailing]]) * The questionnaire and the questions it contains **Important:** In all cases, the deletion __cannot__ be reversed. In some cases, data can be restored from additional backup copies. Whether this is possible depends on if and when backups are made on the survey server. If this is the case, data recovery is still costly. ===== Project Archiving ===== Automatic project archiving is set up on many survey servers. This automatically deletes the collected data if the project manager has not logged into the survey project for a defined period of time (on %%www.soscisurvey.de%% this is e.g. 3 months). In the **Project Settings** you may find an entry //Data storage until min.//, which specifies the date of archiving in case you do not log in to the survey project anymore until then. Address data and separately collected contact data are also deleted during project archiving. The questionnaire incl. questions is stored as an XML file during project archiving, which can be downloaded later in the user account and used to create a new survey project ([[:en:general:copy-project]]). The archiving of a survey project can also be triggered manually under **User account** -> **Projects**. However, only if the survey has already been completed according to the survey period (**Survey Project** -> **Project Settings**). ===== Delete Data Manually ===== Manual deletion of data is only possible when the survey is no longer active in the field. This means: If a //survey period// is set under **Survey project** -> **Project settings**, then a deletion within this period is not possible. If you absolutely have to delete a record in the meantime, enter yesterday's date as the end of the //survey period//. Save, delete the record, and then re-enter the correct end of //survey period//. **Important:** Any interviews in progress will be interrupted by this change. Under **Collected Data** -> **Delete Collected Data** you can either //delete all collected data// or delete individual cases by their case number (CASE). If necessary, you can find the case number under **Collected data** -> **View data**. ===== Timed Deletion ===== This option is especially useful for survey projects that are permanently online. There, in order to comply with data protection requirements, it may be necessary to retain the data for a defined period of time (e.g., one year) and then delete it. To activate a time-controlled deletion, click on the plus symbol at //Automatic deletion of old records//. Then you can enter the period. After confirmation of the data, older cases in the data set are immediately deleted and in the future older cases will be cleaned up once a day. ===== Delete Data via API ===== The //API URLs for deleting cases from the record// function can be used to create URLs (hyperlinks) by calling which you can delete single or multiple records. **Important:** Any person who knows the URL can delete records. The URLs are as sensitive as the login password. Do not share the URLs with third parties. Do not store the URLs unprotected as well as passwords. Use a password manager such as [[https://keepassxc.org/|KeePass XC]]. To create an API URL, click the plus icon next to //API URLs to delete cases from record//. Optionally, you can restrict here that only data records of certain questionnaires can be deleted with the URL. If you do not select any questionnaires, you can use the URL to delete all cases in the dataset. A URL entry is displayed in the list after saving. Copy the URL and call it together with the following GET or POST parameters to delete data (without confirmation!): * //cases//\\ One or more case numbers (CASE), separated by commas, e.g. ''12'' or ''12,21,25''. A hyphen (''-'') can also be used to specify ranges, e.g. ''10-16''. The combination is also possible, e.g., ''10:12-16:34''. * //format// (optional)\\ A specification whether the result of the deletion should be reported as ''JSON'' (default) or as text ''plain''. To submit the parameters using GET, add an ampersand (''&'') after the API URL. So, for example, if the API URL is as follows.: https://www.soscisurvey.de/PROJEKT/?act=uDywDXaYyNEY Then the following call would delete cases 120 and 121. https://www.soscisurvey.de/PROJEKT/?act=uDywDXaYyNEY&vSkipTime&cases=120,121 To get the result as text instead of JSON, you would still add the ''format'': https://www.soscisurvey.de/PROJEKT/?act=uDywDXaYyNEY&vSkipTime&cases=120,121&format=plain By default, SoSci Survey transmits a JSON string with the following properties as a response: * ''result'' -- Result of the call * ''ok'' -- The data was deleted as specified * ''warning'' -- it was not possible to delete all data * ''error'' -- The request was incorrect and could not be executed Provided the request was performed, the following properties are still included (''failed'', ''not_found'' and ''msg'' are only included if data for them is available): * ''deleted'' -- List of deleted cases * ''failed'' -- List of cases where an error occurred * ''not_found'' -- List of cases which were specified individually but not found in the data set (if ranges of case numbers were specified, the case numbers contained therein are not expanded here). * ''msg'' -- Messages (error code and text information) generated during deletion. Provided that the request was instructed due to an error, the following properties are included: * ''error'' -- Error code, e.g. ''%%'no cases'%%'' or ''%%'no auth'%%'' * ''info'' -- Error message The delete request is executed with the rights of the user account in which the URL was created. If the permission to delete records is revoked from this user account, the error ''no auth'' is returned.