mchev/laravel-odk

Error in Update Answers

Closed this issue · 4 comments

Trying to update the answers using the following

$answers = OdkCentral::projects($projectId)->forms($xmlFormId)->submissions($submissionId)->answers()->update([
  'HeadOfHouseholdName' => 'Test Update'  // this is as per my demo ODK form
]);

But, this work like a charm for the status

// Updating Submission metadata
$submissions = OdkCentral::projects($projectId)->forms($xmlFormId)->submissions($instanceId)->update([
  'reviewState' => 'approved' // null, edited, hasIssues, rejected, approved | enum
]);
mchev commented

Unfortunately there is actually no way to update an individual answer.

I just read the doc https://odkcentral.docs.apiary.io/#reference/submissions/submissions/updating-submission-data and saw that was possible.

To create a method that update an answer it will be necessary to have a deprecatedID and the instanceID. Unless you send the whole xml as body :

<data id=\"simple\">
  <orx:meta>
    <orx:deprecatedID>uuid:315c2f74-c8fc-4606-ae3f-22f8983e441e</orx:deprecatedID>
    <orx:instanceID>uuid:85cb9aff-005e-4edd-9739-dc9c1a829c44</orx:instanceID>
  </orx:meta>
  <name>Alice</name>
  <age>36</age>
</data>

I'll try figure out to implement this in a next version.

Thank you. It will be a great feature to have.
Will be waiting for the next version.

@mchev I have tried to do the XML update. But couldn't succeed. Any idea or roadmap to include the feature in this component? This update feature shall be the utmost required. Please help.