Skip to content
This repository was archived by the owner on Jan 21, 2021. It is now read-only.
This repository was archived by the owner on Jan 21, 2021. It is now read-only.

Implement basic client form API #497

@ekigamba

Description

@ekigamba

The forms API will have the following endpoints:

  • Search
  • Add

Search endpoint

The search endpoint enables download of form and their subforms by referencing the form. The search endpoint is accessible via basic auth by normal users

This is a GET request endpoint with the following params:

PARAM NAME Data type Mandatory Description
form_identifier String Yes This is the path to the form on the client app
form_version String Yes This is the semantic version of the form as stated in the manifest
current_form_version String No This is the current form_version for the specific form

The endpoint will return a 200 and:

  • the specific form in case the current_form_version was not sent
  • the specific form in case the current_form_version is lower than the currently available version for that form_identifer upto form_version provided

This endpoint will fail and return the respective http code if:

  • The form_identifier does not exist in the DB
  • The current_form_version is higher than the form_version

Add endpoint

This endpoint enables you to publish a forms one at a time. The search endpoint is accessible via basic auth by admins. The following params should be passed to the add endpoint:

This is a POST request

PARAM NAME Data type Mandatory Description
form_version String Yes This is the semantic version of the form
form_identifier String Yes This is the path to the form on the client app
form_name String Yes This is the human readable form name that will be displayed when the Forms API gets a UI
form file Yes The actual file with a .json extension
module String No A small title detailing the module to which the form belongs

The endpoint will return a 201 in case the operation was a success
The endpoint will return a 400 in case the operation failed and a message in the body

The add endpoint will return a 400 if:

  • Either of the params is not provided, empty or provided in the wrong format(500)
  • The form_version does not follow semantic versioning
  • The form does not have a .json extension

Both endpoints will return a 401 if you are using wrong credentials or don't are not authorized to access the endpoint

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions