Skip to content

Add documentation for integrity URL #1926

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ Please [file an issue](https://github.com/getodk/docs/issues) if you can't find

We highly recommend you use a virtual environment like [`virtualenv`](https://virtualenv.pypa.io/en/stable/). If you need to use different versions of Python, we recommend [`pyenv`](https://github.com/pyenv/pyenv).

You can also use Docker to build and view the docs:

```bash
make autobuild-docker
```

### Cloning the repo

Clone the docs repo and make sure all the requirements are installed:
Expand Down
5 changes: 3 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
'openapi',
'sphinxext.opengraph',
'notfound.extension',
'sphinx_sitemap'
'sphinx_sitemap',
'myst_parser'
]

# If using Apple Silicon, set env variable (assumes brew install of enchant)
Expand Down Expand Up @@ -148,4 +149,4 @@
'incl/form-examples/regex-middle-initial/',
'incl/form-examples/sum-to-count-responses/',
'search/'
]
]
1 change: 1 addition & 0 deletions docs/openrosa-form-list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ Elements within ``<mediaFile/>``
- ``<filename/>`` The unique un-rooted file path for this media file. This un-rooted path must not start with a drive name or slash and must not contain relative path navigations (for example, ``.`` or ``..``).
- ``<hash/>`` The hash value of the media file available for download. The only hash values currently supported are MD5 hashes of the file contents; they are prefixed by ``md5:``. If the hash value identified in the manifest differs from the hash value for a previously-downloaded media file, then the file should be re-fetched from the server.
- ``<downloadUrl/>`` A fully qualified URI for downloading the media file to the device. It may be a valid http or https URI of any structure; the server may require authentication; the server may require a secure (https) channel, etc.
- ``<integrityUrl/>`` A fully qualified URI for using the :doc:`Integrity API <openrosa-integrity>` for this media file. This is optional, but must be present if the media file has the ``type`` attribute with the value ``entityList``.

``<mediaFile/>`` attributes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
44 changes: 44 additions & 0 deletions docs/openrosa-integrity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Integrity API

This standard defines how clients can check the integrity of entity lists that are attached to forms as media files.

## Integrity request

Integrity requests can be made with an HTTP `GET` request to the server provided integrity URL with a comma-separated `id` query parameter specifying the ids of entities being checked. For example:

```
https://example.com/integrity?id=1,2,3
```

This request will return an integrity document.

### Integrity document

The structure of the integrity document returned by an integrity request is as follows:

```xml
<?xml version='1.0' encoding='UTF-8'?>
<data>
<entities>
<entity id="24b47424-ccf8-4f4b-b4cd-34ff5c71eddd">
deleted>true</deleted>
</entity>
<entity id="9e32d18f-d51a-4826-a8b2-e9b1c6d10b58">
<deleted>false</deleted>
</entity>
</entities>
</data>
```

This document consists of:

- A top-level `<data/>` tag in the `http://openrosa.org/xforms/xformsIntegrity` namespace enclosing:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lognaturel We don't currently include a namespace in the integrity response. My guess is we should as we do for manifest and form list responses. These namespaces don't actually resolve to anything, however. Is openrosa.org something we actually own?

- zero or more `<entity/>` tags containing a exactly one `<deleted/>` tag

#### Elements with `<entity/>`

- `<deleted/>` should contain `true` if the entity has been deleted on the server, and `false` if not

#### `<entity/>` attributes

- `id`: id of the entity
1 change: 1 addition & 0 deletions docs/openrosa.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ OpenRosa 1.0 APIs were formally approved by the OpenRosa Working Group in Decemb
openrosa-authentication
openrosa-form-submission
openrosa-form-list
openrosa-integrity
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ pyyaml
sphinxext-opengraph
sphinx-notfound-page
sphinx-sitemap
myst-parser