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

Implement basic client form API #497

Open
ekigamba opened this issue Aug 2, 2019 · 0 comments
Open

Implement basic client form API #497

ekigamba opened this issue Aug 2, 2019 · 0 comments
Assignees

Comments

@ekigamba
Copy link

ekigamba commented Aug 2, 2019

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

@ekigamba ekigamba self-assigned this Aug 6, 2019
@ekigamba ekigamba changed the title Implement basic form submissions API Implement basic client form API Aug 16, 2019
ekigamba added a commit to opensrp/opensrp-server-web that referenced this issue Mar 19, 2020
- Add clientForm/add POST endpoint that accepts multipart/form-data that adheres to the specification here opensrp/opensrp-server#497
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant