Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rest service not triggered after updating a submission #2781

Open
paolagrisales opened this issue Sep 2, 2020 · 5 comments
Open

Rest service not triggered after updating a submission #2781

paolagrisales opened this issue Sep 2, 2020 · 5 comments
Labels
Back end bug Things broken and not working as expected check-if-stale

Comments

@paolagrisales
Copy link

Description

I have a rest service called when I submit a form for the first time. However, when I select one of the submission and make some changes, the Rest service is not called at all. I would expect my service to be called with the updated submission.
Is there anything I can change to make this work?

Steps to Reproduce

  1. Create a rest service with POST; deploy it in an onpremise installation
  2. Create a sample form, using an onpremise deployment
  3. Configure the form to call the exposed service a as a hook
  4. Submit a form
  5. Select the sent form and make some changes
    image

Expected behavior

I would expect my rest service to be called with the updated submission

Actual behavior

request not sent to the hook

Additional details

Environment: docekr deploy over ubuntu 20.04 LTS on premise installation

@jnm
Copy link
Member

jnm commented Sep 2, 2020

The REST Services feature wasn't designed to push edits, and changing that behavior would break people's existing workflows that assume each POST is a new submission. You're not the only one who'd like this functionality, though: kobotoolbox/kobocat#572.

Maybe edits could be sent to a separate endpoint, or with a PATCH? How would you expect to distinguish between new submissions and edits?

@paolagrisales
Copy link
Author

paolagrisales commented Oct 2, 2020

Sorry for the slow response, I'm using the same endpoint because only I need to insert every submission, no matter if it's new or edition.
I already removed the "and created" but doesn't work still, despite no error the REST Service not triggered.
Can you tell me where the kobocat's log is?

@noliveleger
Copy link
Contributor

Hello @paolagrisales,
I think you misunderstood what @jnm said. The REST Services feature does not support edition. Nothing is triggered on update/delete. The REST Services is only triggered on new submissions.

@jnm
Copy link
Member

jnm commented Oct 22, 2020

Sorry about and created: that's not enough because of the checking that KPI has to prevent multiple POSTs. I edited my comment at kobotoolbox/kobocat#572 (comment) to avoid wasting more people's time.

I'm going to include some of what I said there below, because I think there's more work to do on KPI (this repository) than KoBoCAT if someone wants to implement pushes to external services when submissions are edited.

  1. Add a new option for re-submitting edits in the KPI UI (default to false for all existing REST Services);
  2. Somehow communicate that option to KC so that KC knows whether to resubmit edits to KPI;
    • Or, [my preference] have KC always resubmit edits to KPI, but have them somehow tagged as edits instead of new submissions. Then, KPI can decide whether to re-send them to the external server;
  3. Decide whether to use PUT or POST (or make it configurable?)
  4. Make sure duplicate submission IDs don't cause a problem with KPI's REST service logging;
  5. Be done and enjoy?

The KoBo core team doesn't have any time to undertake this in the foreseeable future, but we could try to direct others and review PRs. I'm tagging @taylordowns2000, who expressed interest in this over at kobotoolbox/kobocat#572. @paolagrisales, perhaps you can collaborate on this.

@wu-lee
Copy link

wu-lee commented Jun 17, 2021

I'd like to express our interest in this feature as well. We would like to connect surveys to a map which gets updated on any changes, including edits to existing submissions.

@JacquelineMorrissette JacquelineMorrissette added bug Things broken and not working as expected check-if-stale labels Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Back end bug Things broken and not working as expected check-if-stale
Projects
None yet
Development

No branches or pull requests

5 participants