API Push Schedules
An API push schedule sends questionnaire results to an external system's API, automatically and on a recurring schedule. Instead of exporting collected data by hand and importing it somewhere else, each submitted result is forwarded to the receiving API on a day and at a time that suits the organisation.
A schedule decides which questionnaires are pushed, which results qualify (optionally only results matching a condition), how the answers map onto the fields the API expects, and when the push runs. Every result is pushed once only — the system remembers which results have already been sent, so nothing is duplicated on the receiving side.
API push schedules are useful when:
- Questionnaire results collected in the field need to reach a central system every night without manual exports.
- A partner system must receive submitted records as soon as they are finalised, for example inspection or visit reports.
- Only a subset of results should be forwarded — for example only rows where a finalised flag is set, or where a result answer matches a value.
- The receiving API must never see the same result twice, even when the schedule runs again.
Every pushed record is tracked on the API push status page, which shows per schedule how many results were pushed, how many came back with warnings, how many failed and why, and lets the user retry or dismiss failed rows.
How an API push schedule works
An API push schedule is defined by the following settings:
| Setting | Purpose |
|---|---|
| Name | A label for the schedule, shown in the list. |
| Report type | Set to API push. |
| Questionnaires | The questionnaires whose results are pushed. Every result of a selected questionnaire is eligible; each result is sent once only. |
| Push when question, Condition, Value | Optional filter on the results. Only results whose answer to the chosen question matches the condition and value are pushed. Leave the question empty to push every result. |
| API config | A JSON block describing the API call: the URL and method, authentication, which questionnaire answers and registration values map to which remote fields, which fields are required, and which questions identify a row on the status page. |
| Frequency | Daily, weekly or monthly. |
| Send time and timezone | The time of day the push runs, and the timezone that time refers to. |
| Active | Whether the schedule runs at all. An inactive schedule is kept but does not push. |
Unlike report schedules, an API push sends nothing by email — there are no recipients, subject or email template, and those fields are not shown. Push schedules are managed on the Scheduled Reports page, the same page used for emailed reports and API imports.
How the push works
Each run collects the results of the selected questionnaires that have never been pushed by this schedule, applies the optional condition, and sends them to the API in a single batch. A run pushes at most 500 records on its regular schedule (1,000 on a manual run); anything beyond the cap waits for the next run.
- Every result is sent once. Before a record is posted, the run claims it. A result that already has a claim — whether it was sent, failed or dismissed — is never selected again. If two runs race for the same result, only one can claim it.
- Required fields are checked first. If a remote field listed as required resolves to an empty value, the record fails before any request is made — it is recorded as failed with the reason (for example missing date) so the API never sees an incomplete record.
- Per-record results. The API answers with one status per record. Accepted records are marked pushed; records the API already had count as duplicates; records the API rejects are marked failed with the message it returned. A record the API accepted but flagged is pushed with a warning — it counts as pushed and is not retried, and the warning text is shown on the status page.
- Failures are isolated. A record that fails stays failed on the status page until it is retried or dismissed; it does not block other records. If the API itself is unreachable, the run releases its claims so the next run tries the same records again, and the failure is shown as the schedule's last result in the list.
The list of schedules
The Scheduled Reports page shows one row per schedule. Each row summarises the schedule without opening it:
- Name. The label the user chose for this schedule.
- Report. For push schedules this shows the type.
- Schedule. How often the push runs. For weekly schedules it includes the weekday; for monthly schedules the day of the month.
- Time. The time of day and time zone the push runs.
- Next run. The date the schedule is next due.
- Last run. The date the schedule last ran, so the user can tell at a glance whether the push is running.
- Active. A checkbox that shows whether the schedule is currently running. The user can clear it to pause the schedule without deleting it.
- Actions. A pencil to edit the schedule, and a bin to delete it.
Adding a schedule
Pressing the Add schedule button at the top of the page opens a dialog. The same dialog is used to edit an existing schedule, pre-filled with its current settings.
1. Name
A label for the schedule, used in the list. Choose something that describes what is pushed, such as Nightly visit reports or Finalised results push.
2. Report type and Questionnaires
Choose API push as the report type. The dialog then shows a checklist of questionnaires — tick every questionnaire whose results should be pushed. At least one questionnaire is required before the schedule can be saved.
3. Push when question, Condition and Value
An optional filter. Choose a question, an operator (=, !=, contains, <, <=, >, >=) and a value, and only matching results are pushed — for example question finalised, condition =, value 1 pushes only finalised results. A value starting with = is evaluated as a formula at run time. Selecting no question pushes every result.
4. API config
A JSON block describing the API call and the field mapping. A working starting point is filled in automatically when the report type is selected; the user edits it to match the receiving API. The keys are:
| Key | Purpose |
|---|---|
| request | The API call itself: url, method (POST by default) and fixed headers. The records are posted as one JSON batch under records. |
| auth | How the call is authenticated: none, basic (username and password), bearer (token) or apikey-header (name and value). |
| mapping | Remote field names mapped to question names in the questionnaire — for example "reference": "reportNumber". The result's answer to that question is sent as that field. Each record also carries its result id automatically as fksurveyresultid. |
| registration | Remote field names mapped to questions on the result's linked registration row — for example "customer_id": "customer id" sends the registration's answer to customer id. Use this for values that live on the customer, site or subject the result belongs to rather than on the questionnaire itself. |
| static | Remote field names with a constant value sent on every record — for example a fixed source label or region code. |
| required | Remote fields that must resolve to a non-empty value. A record missing one fails before the request is made, with the reason shown on the status page, so the API never receives an incomplete record. |
| identify | Two or three labels mapped to question names, shown as identity columns on the API push status page so a row can be recognised at a glance — for example "Reference": "reportNumber". Prefix a question name with reg: to read it from the linked registration instead of the questionnaire, for example "Customer": "reg:Customer name". |
A typical configuration looks like this:
{
"request": {
"method": "POST",
"url": "https://example.org/api/web/v1/visits/push",
"headers": { "Accept": "application/json" }
},
"auth": { "type": "basic", "username": "WEB", "password": "..." },
"mapping": {
"date": "visitDate",
"reference": "reportNumber",
"result": "visitResult",
"notes": "notes"
},
"registration": { "customer_id": "customer id" },
"static": { "source": "survey" },
"required": ["reference", "customer_id", "date", "result"],
"identify": {
"Reference": "reportNumber",
"Date": "visitDate",
"Customer": "reg:Customer name"
}
}
The receiving API is expected to answer with one result per record, each carrying the record's fksurveyresultid and a status: accepted records mark the row pushed, duplicate counts it as already known, error fails it with the returned message, and an optional warning keeps the row pushed while recording the warning on the status page. A remote record id returned by the API is stored with the row.
Below the editor the dialog validates the configuration as it is typed: a missing URL or an empty mapping is shown as an error and blocks saving.
5. Frequency
How often the push runs: daily, weekly or monthly. When weekly is selected, the dialog shows a weekday picker; when monthly is selected, a day-of-month picker.
6. Send time and timezone
The time of day the push runs, and the timezone that time refers to — for example 18:00 in the organisation's own timezone, so the day's collected results reach the API before the next morning.
7. Active
A checkbox at the bottom of the dialog. When ticked, the schedule is live and pushes on its next due date. When unticked, the schedule is kept in the list but does not run.
Saving, testing and running
At the bottom of the dialog, the user has four buttons.
Cancel
Close the dialog without saving. Any changes are discarded.
Test
Count the results that would be pushed — nothing is sent. The result shows how many results qualify, the field names of a sample record so the mapping can be checked, and any problems found, for example records that would fail a required field. Test is only available after the schedule has been saved once, and it is the recommended first step whenever the configuration changes.
Run
Execute the push immediately instead of waiting for the next due date — up to 1,000 records per manual run. The outcome is shown in the dialog: how many records were pushed, how many the API reported as duplicates, how many failed and how many were skipped.
Save
Save the schedule. Save is disabled until at least one questionnaire is chosen and the API config passes validation. If the server rejects any value, the dialog shows the field-level error and does not close.
Monitoring pushed results
The API push status page in the menu shows what every push schedule did with each result:
- A summary table per schedule: how many results were pushed, how many of those came back with warnings, how many failed, are pending, were skipped or were dismissed, plus the outcome of the last run.
- A detail grid listing every pushed or failed result with its identity columns (configured through
identify), the questionnaire, the registration it belongs to, the user, the last attempt time, the remote record id, and the error or warning text. - Retry sends a failed result again on the next run — use it after the reason for the failure has been fixed, for example after filling in the missing answer.
- Dismiss settles a failed row that should not be retried: it drops out of the failed count and is never pushed again, but stays visible as dismissed for auditing.
A Push status report schedule type can also email a summary digest of these counts on a recurring basis, optionally only when there are failures.
Editing, pausing and deleting a schedule
From the list, the user can:
- Pause a schedule by clearing the Active checkbox in the row. The schedule stays in the list; it just will not run on its next due date. Ticking it again resumes the schedule.
- Edit an existing schedule with the pencil icon. The dialog opens with all the settings pre-filled from that schedule.
- Delete a schedule with the bin icon. A confirmation prompt appears first. Deleting a schedule does not delete the pushed results; only the automated push is removed.
If a run fails — for example the API is unreachable or returns an HTTP error — the failure is recorded on the schedule and shown in the list as the last result, so a broken push does not go unnoticed.
Basic examples
Example 1: nightly push of finalised visit reports
Staff collect visit reports with a questionnaire. Each result must reach the central system, but only once the reporter has marked it finalised.
- On the Scheduled Reports page, click Add schedule.
- Name: Nightly visit reports.
- Report type: API push.
- Questionnaires: tick the visit report questionnaire.
- Push when question: finalised, Condition:
=, Value:1— draft results stay behind until they are finalised. - API config: set the API's URL and credentials, map the remote fields onto the questionnaire questions (report number, visit date, result, notes), map customer id onto the registration's customer id question, mark reference, customer id, date and result as required, and add identify labels for Reference, Date and Customer.
- Frequency: Daily.
- Send time: 18:00. Timezone: the organisation's local timezone.
- Active: ticked.
- Save.
- Reopen the schedule and press Test. Check that the number of results that would be pushed looks right and that the sample record shows the expected fields. If it looks right, press Run for a first push.
From now on, every evening the schedule pushes the results finalised since the previous run. Each result is claimed before it is sent, so re-running can never send it twice.
Example 2: handling failed records
After a run, the API push status page shows that one visit report failed with the reason missing result: the required remote field result resolved to an empty answer.
- Open the API push status page from the menu.
- The summary shows Failed: 1 for the schedule; the grid below lists the failed row with its Reference, Date and Customer columns, the reason and the last attempt time.
- Correct the data: edit the questionnaire result so the result question has an answer.
- Press the retry button on the failed row — or Retry all failed when several rows were fixed. The row returns to the queue and is sent on the next run.
- If the row should never be sent — for example it was a test submission — press the dismiss button instead. It leaves the failed count, is never pushed again, and stays listed as dismissed.
The same page shows warnings the API returned for accepted rows — for example a record the API stored with a substituted value. Those rows were pushed successfully; the warning is information, not a failure, and they are not retried.