GetFrags

From ARK
Jump to: navigation, search

This method is used to get a list of data fragments of a specific dataclass and/or classtype within the ARK instance. It will return a JSON array of all the different data fragments attached to a specific item

Path

http://your.ark.instance/api.php?req=getFrags

Arguments

Mandatory

  • item_key - this is the item_key of the required module (for instance 'cxt_cd').
  • item_value - this is the ARK item that you are interested in. This should be sent in the form item_key=item_value. As an example: cxt_cd=LK12_1. A list of available items can be supplied by describeItems.
  • dataclass - this can be any of the main dataclasses, e.g. action,attribute, date, span, xmi, txt, number,file. If you want to return all of the possible data fragment types then set the argument to 'all'.

Optional

  • classtype - if you are only interested in a particular type of data then you can send the classtype as well and this will limit the results
  • aliased - set this argument to 'true' if you want the human-readable aliases to be returned

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

Example

Example 1 - Retrieve all attributes attached to an item

http://your.ark.instance/api.php?req=getFrags&dataclass=attribute&item_key=hut_cd&hut_cd=LK12_1&handle=johndoe&passwd=johndoepassword

Example return (returned JSONified - displayed as an array here for ease of viewing):

Array
(
    [LK12_1] => Array
        (
            [0] => Array
                (
                    [0] => Array
                        (
                            [dataclass] => attribute
                            [id] => 39
                            [attribute] => 89
                            [attributetype] => 14
                            [boolean] => 1
                            [attached_frags] => 
                        )

                    [1] => Array
                        (
                            [dataclass] => attribute
                            [id] => 63
                            [attribute] => 92
                            [attributetype] => 15
                            [boolean] => 1
                            [attached_frags] => 
                        )

                )

        )

)

Example 2 - Retrieve all text of classtype 'notes' attached to an item

http://your.ark.instance/api.php?req=getFrags&dataclass=txt&classtype=notes&item_key=hut_cd&hut_cd=LK12_1&handle=johndoe&passwd=johndoepassword

Example return (returned JSONified - displayed as an array here for ease of viewing):

Array
(
    [LK12_1] => Array
        (
            [0] => Array
                (
                    [0] => Array
                        (
                            [dataclass] => txt
                            [id] => 1
                            [txt] => House 1
                            [txttype] => 108
                            [attached_frags] => 
                        )

                )

        )

)

Example 3 - Retrieve all data fragments attached to an item with Aliases

http://your.ark.instance/api.php?req=getFrags&dataclass=all&item_key=hut_cd&hut_cd=LK12_1&aliased=true&handle=johndoe&passwd=johndoepassword

Example return (returned JSONified - displayed as an array here for ease of viewing):

Array
(
    [LK12_1] => Array
        (
            [0] => Array
                (
                    [0] => Array
                        (
                            [dataclass] => attribute
                            [id] => 39
                            [attribute] => 89
                            [attributetype] => 14
                            [boolean] => 1
                            [attached_frags] => 
                            [attribute_alias] => WSW
                            [alias] => WSW
                        )

                    [1] => Array
                        (
                            [dataclass] => attribute
                            [id] => 63
                            [attribute] => 92
                            [attributetype] => 15
                            [boolean] => 1
                            [attached_frags] => 
                            [attribute_alias] => House
                            [alias] => House
                        )

                    [2] => Array
                        (
                            [dataclass] => txt
                            [id] => 1
                            [txt] => House 1
                            [txttype] => 108
                            [attached_frags] => 
                            [alias] => Notes
                        )

                    [3] => Array
                        (
                            [dataclass] => number
                            [id] => 1
                            [number] => 12
                            [numbertype] => 14
                            [attached_frags] => 
                            [alias] => Diameter
                        )

                    [4] => Array
                        (
                            [dataclass] => number
                            [id] => 22
                            [number] => 13
                            [numbertype] => 15
                            [attached_frags] => 
                            [alias] => Number of Huts that Can See this Hut
                        )

                    [5] => Array
                        (
                            [dataclass] => file
                            [id] => 1
                            [file] => 1
                            [filetype] => 1
                            [attached_frags] => 
                            [alias] => Stone Worlds 
                        )

                    [6] => Array
                        (
                            [dataclass] => file
                            [id] => 2
                            [file] => 2
                            [filetype] => 1
                            [attached_frags] => 
                            [alias] => Stone Worlds 
                        )

                    [7] => Array
                        (
                            [dataclass] => file
                            [id] => 3
                            [file] => 3
                            [filetype] => 1
                            [attached_frags] => 
                            [alias] => Stone Worlds 
                        )

                    [8] => Array
                        (
                            [dataclass] => file
                            [id] => 70
                            [file] => 70
                            [filetype] => 2
                            [attached_frags] => 
                            [alias] => Photo
                        )

                    [9] => Array
                        (
                            [dataclass] => file
                            [id] => 71
                            [file] => 71
                            [filetype] => 2
                            [attached_frags] => 
                            [alias] => Photo
                        )

                )

        )

)