Difference between revisions of "API Update Template Fields"

From IVS Wiki
Jump to: navigation, search
(Created page with "This API call will update an existing field on an existing template. ===Resource URL=== <pre>http://valt.example.com/api/v3/admin/templates/{templateid}/fields/{fieldid}/edit...")
 
(No difference)

Latest revision as of 13:36, 14 April 2020

This API call will update an existing field on an existing template.

Resource URL

http://valt.example.com/api/v3/admin/templates/{templateid}/fields/{fieldid}/edit

Replace {templateid} with the actual id number of the template. Templates are numbered sequentially when added to VALT.

Replace {fieldid} with the actual id number of the fields. Fields 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
on Field is Enabled (True or False) no true
required Field is Required (True or False) no false
type Field Type (Valid Values) no text
name Field Name no 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 Not Found
500 JSON Body Formatted Incorrectly
JSON Response
data
id Field ID
on Field is Enabled (True or False)
req Field is Required (True or False)
type Field Type (Valid Values)
name Field Name
data Default Field Value

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/158/edit?access_token=e82632d19c523678fea3d1016c6df9e9
{
      "on":true,
      "required":true,
      "type":"text",
      "name":"Patient",
      "data":"John Doe"      
}

Successful Response

Sample response is shown with line breaks to make it more readable. Actual responses will not include line breaks.

{
"data":{
"id": 158,
"on": true,
"req": true,
"type": "text",
"name": "Patient",
"data": "John Doe"
}
}

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"
}
}