Posting report to records API

What is the correct form code referred to in the docs?

_meta.form	The form code.

I am met with the Form not found: FF_TASK_TRIGGER when trying to push the following content to the api/v2/records api:

{
  "nurse": "Sam",
  "week": 23,
  "year": 2015,
  "visit": "ANC",
  "_meta": {
    "form": "ff_task_trigger"
  }
}

I’ve checked the form in the db and the api/v1/forms api to make sure I’m using the correct reference:

{
  "_id": "form:ff_task_trigger",
  "_rev": "29-cc4640add12ef189bc66cb284d4424fc",
  "type": "form",
  "internalId": "ff_task_trigger",
  "xmlVersion": {
    "time": 1728030649647,
    "sha256": "3b86b78776726516a815dfbc18c4361a6a9e12850a7350cf627a5a9cdba08458"
  },
...
[
    ...
    "death_report.xml",
    "ff_task_trigger.xml",
    "intermediary.xml"
    ...
]

Hello,

It looks like ff_task_trigger is an XML form?

the records api can only be used with JSON forms

So something like this in forms in app_settings:

"FF_TASK_TRIGGER": {
  "meta": {
    "code": "ff_task_trigger",
  },
  "fields": { },
  "public_form": true
}
1 Like

Thank you @twier ! For interest sake, have you ever managed to kick off a task by submitting one of these JSON forms?

Yes, tasks can be created from JSON forms in the same way as for XML forms.