-
Notifications
You must be signed in to change notification settings - Fork 0
Author Forms and Submit Form Entries
pmontu/drf-form-builder
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This project uses python 3.6.6 * `pip install requirements.txt` * `./manage.py migrate` * `./manage.py loaddata form_builder/fixtures/initial_data.json` * `./manage.py createsuperuser` * `./manage.py runserver` * `$ curl -X POST -d "username=admin&password=password123" http://localhost:8000/api-token-auth/` * `$ curl -H "Authorization: JWT <your_token>" http://localhost:8000/protected-url/` View Form ``` curl -X GET \ http://127.0.0.1:8000/forms/1/ \ -H 'authorization: Basic bWFub2o6MQ==' \ -H 'content-type: application/json' ``` View Attempt ``` curl -X GET \ http://127.0.0.1:8000/attempts/1/ \ -H 'authorization: Basic bWFub2oyOjE=' \ -H 'content-type: application/json' ``` Respond with Text ``` curl -X PATCH \ http://127.0.0.1:8000/attempts/1/fields/1/ \ -H 'authorization: Basic bWFub2oyOjE=' \ -H 'content-type: application/json' \ -d '{ "text": "Manoj Kumar P" }' ``` Respond with Multiple Options ``` curl -X POST \ http://127.0.0.1:8000/attempts/1/fields/2/options/ \ -H 'authorization: Basic bWFub2oyOjE=' \ -H 'content-type: application/json' \ -d '{ "option": 1 }' ``` Workflow ======= Author a Form 1. Create Form `POST http://127.0.0.1:8000/forms/` 2. Add Fields,... 3. Publish Form `POST http://127.0.0.1:8000/forms/:id/publish/` 4. View Forms Created `GET http://127.0.0.1:8000/forms/` Add Fields * Create Multiple Choice Field `POST http://127.0.0.1:8000/forms/:id/fields/ -d {"field": "R", "text": "Married?"}` * Create Text Field `POST http://127.0.0.1:8000/forms/:id/fields/ -d {"field": "T", "text": "Name?"}` * `GET http://127.0.0.1:8000/forms/:id/fields/` * Add Options for Radio Form-Field `POST http://127.0.0.1:8000/forms/1/fields/5/options/ -d {"value": "Choice 1"}` Attempt a Form 1. Create Attempt with fields populated `POST http://127.0.0.1:8000/attempts/ -d {"form": 1}` 2. Text Response `PATCH http://127.0.0.1:8000/attempts/:id/fields/:id/ -d {"text": "value"}` 3. Radio Response `POST http://127.0.0.1:8000/attempts/1/fields/2/options/ -d {"option": 1}` 4. View Attempt `GET http://127.0.0.1:8000/attempts/:id/`
About
Author Forms and Submit Form Entries
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published