forked from AOT-Technologies/forms-flow-ai-doc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom_submission.html
160 lines (135 loc) · 5.67 KB
/
custom_submission.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<article class="docs-article" id="Section">
<section class="docs-section" id="custom_submission">
<div>
<h1>Form Adapter</h1>
<br>
<hr><br>
<p>Formsflow.ai supports submission data to be stored and served using external system. This feature can be used for submission datastore to different database than MongoDB.
If this feature is enabled MongoDB will be used only for form definition data.
A Rest API is needed to support this where customer can add this Rest API to their choice of database and provide the required endpoints.
A reference implementation can be found <a href="https://github.com/AOT-Technologies/forms-flow-ai-submissions/tree/develop/forms-flow-submissions" target="_blank">here</a>
</p>
<p>This feature requires the following env variables set:</p>
<pre>
<code>
#custom submission
CUSTOM_SUBMISSION_ENABLED=false
CUSTOM_SUBMISSION_URL=http://{your-ip-address}:{port}
</code>
</pre>
<!-- <ul>
<li>CUSTOM_SUBMISSION_ENABLED=true
</li>
<li>CUSTOM_SUBMISSION_URL=http://{your-ip-address}:{port}</li>
</ul> -->
<p>
Form Adapter uses custom submission URLs to create, submit, get and edit submissions
within a form to the preferred database. These URLs follow the same URL pattern as the
formio submission URL.
</p>
<h3>Create Custom Form Submission</h3><br>
<i>POST</i><br>
<code>{{CUSTOM_SUBMISSION_URL}}/form/<formid>/submission</code><br><br>
<p>Example of how to create a new form submission within a custom form.</p>
<h5><b>HEADERS</b>
</h5>
<p><b>Authorization Bearer </b>{{token}}
</p>
<p><b>Content-Type </b>application/json
</p>
<h5><b>BODY</b></h5>
<pre>
<code class="hljs"> <br>
{
"data": {
"name": "John",
"age": 21,
"applicationStatus": "",
"applicationId": ""
}
}
</code>
</pre>
<h5><b>Response</b></h5>
<pre>
<code>
<br>
{
"created": "2022-08-03 09:32:59.448886",
"_id": "04016fac-8811-4762-859b-0c664c2490b5",
"form": "62da4ec3e44bcd4da0454ae1",
"data": {
"name": "John",
"age": 21,
"applicationStatus": "",
"applicationId": ""
},
"modified": "2022-08-03 09:32:59.448893"
}
</code>
</pre><br>
<h3>Get a Submission</h3><br>
<i>GET</i>
<code>{{CUSTOM_SUBMISSION_URL}}/form/<formid>/submission/<submission_id></submission_id></code><br>
<br>
<p>Retrieve a single submission within a form.</p>
<h5><b>Headers</b></h5>
<p><b>Authorization Bearer</b> {{token}}</p>
<p><b>Content-Type</b> application/json</p>
<h5>Response</h5>
<pre><code class="hljs"><br>
{
"created": "2022-08-03 09:32:59.448886",
"_id": "04016fac-8811-4762-859b-0c664c2490b5",
"form": "62da4ec3e44bcd4da0454ae1",
"data": {
"name": "John",
"age": 21,
"applicationStatus": "",
"applicationId": ""
},
"modified": "2022-08-03 09:32:59.448893"
}
</code></pre>
<h3>Update a Submission</h3><br>
<i>PUT </i>
<code>{{CUSTOM_SUBMISSION_URL}}/form/<formid>/submission/<submission_id></code><br><br>
<p>Update the whole submission.</p>
<h5><b>HEADERS</b></h5>
<p><b>Authorization Bearer </b>{{token}}</p>
<p><b>Content-Type</b> application/json</p>
<h5><b>BODY</b></h5>
<pre><code class="hljs"><br>
{
"data": {
"name": "John Joe",
"age": 22,
"applicationStatus": "",
"applicationId": ""
}
}
</code></pre>
<h3>Partial Update a Submission</h3>
<p><b>PATCH</b></p>
<code>{{CUSTOM_SUBMISSION_URL}}/form/<formid>/submission/<submission_id></code><br><br>
<h5><b>HEADERS</b></h5>
<p><b>Authorization Bearer</b> {{token}}</p>
<p><b>Content-Type</b> application/json</p>
<h5><b>BODY</b></h5>
<pre><code class="hljs"><br>
{
"data": {
"applicationStatus": "New",
"applicationId": "1234"
}
}
</code></pre>
<p><strong>NOTE</strong>: In case of reviewer actions, if submission data need to be updated directly from the form, call customSubmissionUrl instead of formio.
</p>
<img src="./assets/images/formadapter1.png" width="800"></img>
<br><br><br>
<img src="./assets/images/formadapter2.png" width="400" height="500"></img>
</div>
</section>
</article>
<script>hljs.initHighlighting();</script>