Skip to content

Commit

Permalink
docs: add examples for webhook request body on each event type
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Jan 29, 2025
1 parent aeeaf3e commit 4716bbc
Showing 1 changed file with 46 additions and 3 deletions.
49 changes: 46 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@

Call a remote API on ODK Central database events:

- New submission.
- Update entity.
- New submission (XML).
- Update entity (entity properties).
- Submission review (approved, hasIssues, rejected).

## Prerequisites

- ODK Central running, connecting to an accessible Postgresql database.
- A POST webhook endpoint on your service API, to call when the selected
event occurs.

## Usage

Expand All @@ -26,7 +33,7 @@ Then run with:
```

> [!TIP]
> It's possible to specify a webhook for only Entities or Submissions, or both.
> It's possible to specify a single webhook event, or multiple.
### Docker

Expand Down Expand Up @@ -93,6 +100,42 @@ if err != nil {
> To not provide a webhook for either entities or submissions,
> pass `nil` instead.
## Request Examples

### Entity Update (updateEntityUrl)

```json
{
"type": "entity.update.version",
"id":"uuid:3c142a0d-37b9-4d37-baf0-e58876428181",
"data": {
"entityProperty1": "someStringValue",
"entityProperty2": "someStringValue",
"entityProperty3": "someStringValue"
}
}
```

### New Submission (newSubmissionUrl)

```json
{
"type": "submission.create",
"id":"uuid:3c142a0d-37b9-4d37-baf0-e58876428181",
"data": {"xml":"<?xml version='1.0' encoding='UTF-8' ?><data ...."}
}
```

### Review Submission (reviewSubmissionUrl)

```json
{
"type":"submission.update",
"id":"uuid:5ed3b610-a18a-46a2-90a7-8c80c82ebbe9",
"data": {"reviewState":"hasIssues"}
}
```

## APIs With Authentication

Many APIs will not be public and require some sort of authentication.
Expand Down

0 comments on commit 4716bbc

Please sign in to comment.