Difference between revisions of "PutField"

From ARK
Jump to: navigation, search
(Example 3 - Deleting a number)
(Example 3 - Deleting a number)
 
(One intermediate revision 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&field=conf_field_diameter&hut_cd=LK12_3&update_db=delfrag&dclass=number&delete_qtype=del&frag_id=73
+
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):
 
Example return (returned JSONified - displayed as an array here for ease of viewing):

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

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

http://your.ark.instance/api.php?req=putField&item_key=hut_cd&itemval=LK12_3&field=conf_field_diameter&diameter=8.9&diameter_qtype=add&handle=johndoe&passwd=johndoepassword

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

http://your.ark.instance/api.php?req=putField&item_key=hut_cd&itemval=LK12_1&field=conf_field_description&notes=Houseagogo&notes_id=1&notes_qtype=edt&handle=johndoe&passwd=johndoepassword

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

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):

Array
(
    [messages] => Array
        (
            [0] => Update Successful
        )

    [errors] => 
)