This action inserts a new record or records in the ExtraView database from input formatted with XML. The input can be made as part of the HTTP data stream, or can be input from a file in XML format.
http://www.myserver.com/evj/ExtraView/ev_api.action?
user_id=username
&password=password
&statevar=insert_xml
&xml_file_name=filename | &xml_string=xml_data
&p_template_file=file.html
[&access_token=token-value]
The statevar must be insert_xml
.
Provide either the xml_file_name or xml_string, but not both. You provide xml_file_name if the input is from a file that exists at the time of the execution of the command. You provide xml_string, if the data for the insert is provided as part of the HTTP request. This string contains the XML data to be parsed.
The optional access_token
parameter allows you to use a valid OAuth2 token obtained with the get_token
command. If you provide the access_token
parameter, then the user_id
and password
parameters should not be provided. This prevents the password being sent in clear text over your network connection.
p_template_file is the name of the template to be used for return value string generation. Generally, this template file is stored on the server in the WEB-INF/user_templates directory. On normal completion of the operation, this template undergoes parameter substitution with the following variable names:
Tag | Explanation |
__ID__ | The item number of the last item inserted |
__NUMBER_ITEMS_INSERTED__ | The number of inserted items |
__ITEM_TITLE__ | The title of the ITEM_ID dictionary entry |
See the section on Templates for a full explanation of how to create user templates. If no template file is requested, the command returns a completion message to the calling program via HTTP.
On error completion, the return string contains an error message substituted into the error.html user template in the format:
error-message "at line=xxx and column number=yyy"
where xxx and yyy are the values returned by the XML parser.
As an example, the following message may be returned:
"The end-tag for element type "ITEM" must end with a '>' delimiter at line=8 and column number=9"
Only one record should be inserted with the XML_STRING in one call to the API. When the input is in a file, there is no restriction to the number of records in a single operation.
The Administration Guide contains additional information, including the DTD for the XML data and a list of all possible errors.