Difference between revisions of "PutField"
(→Example 3 - Deleting a number) |
(→Example 3 - Deleting a number) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 70: | Line 70: | ||
====Example 3 - Deleting a number==== | ====Example 3 - Deleting a number==== | ||
− | http://your.ark.instance/api.php?req=putField | + | http://your.ark.instance/api.php?req=putField&update_db=delfrag&dclass=number&delete_qtype=del&frag_id=73 |
+ | Example return (returned JSONified - displayed as an array here for ease of viewing): | ||
+ | |||
+ | <pre> | ||
Array | Array | ||
( | ( | ||
Line 81: | Line 84: | ||
[errors] => | [errors] => | ||
) | ) | ||
+ | </pre> |
Latest revision as of 10:30, 9 December 2013
This method is used to add, edit or delete the contents of a field on an ARK instance.
Please note this method respects any security conditions set in the subform configuration - therefore if fields are, for instance, being restricted on userids or security groups they will not be made available for return or manipulation by the API.
PLEASE BE CAREFUL using this call - as you are directly interacting with the database and you could easily accidentally delete or edit data. The API does NOT provide any 'are you sure' fallbacks and therefore mistakes may be hard to rectify
Contents
Path
http://your.ark.instance/api.php?req=putField
Arguments
As the arguments needed for each field vary depending on the validation functions that are applied to the field, this arguments needed by putField() will vary. A list of the variable names needed (for add or edit) per field can be obtained by using describeFields(). However, some arguments will be pretty-much standard across all fields
- item_key - this is in the form 'cxt_cd' and refers to the module of the item to be changed.
- itemval - this is the itemvalue of the item that is to be changed
- field - this is the name of the field to be changed
If anonymous logins are not enabled a username and password will need to be supplied:
- handle - username
- passwd - password
The method returns a JSON array unless otherwise specified:
- format - 'json' by default, but sending 'html' prints a human-readable array to screen
Examples
Example 1 - Adding a new number
Example return (returned JSONified - displayed as an array here for ease of viewing):
Array ( [messages] => Array ( [0] => Update Successful ) [errors] => )
Example 2 - Editing some text
Example return (returned JSONified - displayed as an array here for ease of viewing):
Array ( [messages] => Array ( [0] => Update Successful ) [errors] => )
Example 3 - Deleting a number
Example return (returned JSONified - displayed as an array here for ease of viewing):
Array ( [messages] => Array ( [0] => Update Successful ) [errors] => )