I think after a couple of hours I got the gist of it. The following will be documentation to remind myself how this is done.
So, requirements:
1. Limesurvey need to set "Allow multiple responses or update responses with one token:" to TRUE under Survey - Participant Settings otherwise you get the response "Error: Survey does not allow edit after completion."
2. Authenticate using your standard:
Code:
skey <- get_session_key()
as described on
limer
github page
3. Then your update response method will be invoked via
:
Code:
call_limer(method = "update_response",
params = list(iSurveyID = limeSurveyNumber,
aResponseData = aResponseData)
)
where iSurveyID is your survey number and aResponseData you need to construct from your survey answers. If you have made a dataframe like
Code:
initData <- get_responses(limeSurveyNumber)
your fields that you can update as you like are the column names of your dataframe,
with the exception of that actual question. In the dataframe you get the question code you assigned in LS interface as the column name. In your code you need to identify this field with the
SGQA
identifier.
So an example of things that you could update for a textual question would be:
Code:
aResponseData <- list("id" = 3,
"submitdate" = "2028-04-23 10:04:34",
"lastpage" = 1,
"startlanguage" = "en",
"seed" = '111111222',
"startdate" = "nodate",
"datestamp" = "2023-03-23 10:04:34",
"891422X157X1357" = "my new text response"
)
If your date fields (which you get when you ask the survey to store timings - that sets submitdate to complete responses and also makes startdate and datestamp fields) do not parse - the date will be set to 0000-00-00 00:00:00.
The good news is - you can update as few fields in the response as you like. The only thing that must be there is the id (or token) field - so that LS knows which response to update.
In my case I can construct a very simple response array (list) like this:
Code:
aResponseData <- list("id" = 3, "submitdate" = "2022-05-23 10:04:38")
The other fields that are mentioned (including the original answer) simply do not get updated (hopefully this could be confirmed by moderators).