API Add Template Fields
Revision as of 14:35, 14 April 2020 by IVSWikiBlue (talk | contribs) (Created page with "This API call will add a new field to an existing template. ===Resource URL=== <pre>http://valt.example.com/api/v3/admin/templates/{templateid}/fields</pre> ''Replace {templa...")
This API call will add a new field to an existing template.
Contents
Resource URL
http://valt.example.com/api/v3/admin/templates/{templateid}/fields
Replace {templateid} with the actual id number of the template. Templates are numbered sequentially when added to VALT.
Resource Information
| Method | POST |
| Headers | Content-Type:application/json |
| Response Type | JSON |
| Authentication Required | Yes |
Parameters
The JSON body must be properly formatted. All fields and values should be enclosed in double quotes and separated by a colon.
| Field Name | Description | Required | Example | |
|---|---|---|---|---|
| fields | Array of JSON objects containing specifications for additional fields. | no | [{"on":true,"required":true,"type":"text","name":"Patient Name","data":"John Doe"}] | |
| on | Field is Enabled (True or False) | no | true | |
| required | Field is Required (True or False) | no | false | |
| type | Field Type (Valid Values) | yes | text | |
| name | Field Name | yes | Patient Name | |
| data | Default Field Value | no | Jane Doe | |
Response
| Code | Reason |
|---|---|
| 200 | Template Created Successfully |
| 400 | Invalid Request (See Response for Specific Error) |
| 401 | Unauthorized |
| 404 | Template ID Not Found |
| 500 | JSON Body Formatted Incorrectly |
| data | |
|---|---|
| id | ID number for the new field. |
Examples
Request
The sample JSON body below is formatted with line breaks and indentation to make it easier to read. This is not required.
https://ivstest1.ad.ipivs.com/api/v3/admin/templates/52/fields?access_token=e82632d19c523678fea3d1016c6df9e9
{
"fields":
[
{
"on":true,
"required":true,
"type":"text",
"name":"Patient Name",
"data":"Jane Doe"
}
]
}
Successful Response
Sample response is shown with line breaks to make it more readable. Actual responses will not include line breaks.
{
"data":{
"id": 48
}
}
Failure Response
Sample response is shown with line breaks to make it more readable. Actual responses will not include line breaks.
{
"error":{
"code": 500,
"message": "Internal Server Error"
}
}