Difference between revisions of "GetFrags"
From ARK
(→Arguments) |
(→Optional) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
===Path=== | ===Path=== | ||
− | http://your.ark.instance/api.php? | + | http://your.ark.instance/api.php?req=getFrags |
===Arguments=== | ===Arguments=== | ||
Line 26: | Line 26: | ||
*'''passwd''' - password | *'''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=== | ||
− | http://your.ark.instance/api.php? | + | ====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): | Example return (returned JSONified - displayed as an array here for ease of viewing): | ||
− | <pre> | + | <pre>Array |
− | Array | ||
( | ( | ||
− | [ | + | [LK12_1] => Array |
( | ( | ||
[0] => Array | [0] => Array | ||
( | ( | ||
− | [0] => | + | [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] => | ||
+ | ) | ||
+ | |||
) | ) | ||
− | [ | + | ) |
+ | |||
+ | ) | ||
+ | </pre> | ||
+ | |||
+ | ====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): | ||
+ | |||
+ | <pre>Array | ||
+ | ( | ||
+ | [LK12_1] => Array | ||
+ | ( | ||
+ | [0] => Array | ||
( | ( | ||
− | [0] => | + | [0] => Array |
− | + | ( | |
− | + | [dataclass] => txt | |
− | + | [id] => 1 | |
− | + | [txt] => House 1 | |
− | + | [txttype] => 108 | |
− | + | [attached_frags] => | |
− | + | ) | |
− | + | ||
− | |||
) | ) | ||
− | [ | + | ) |
+ | |||
+ | ) | ||
+ | </pre> | ||
+ | |||
+ | ====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): | ||
+ | |||
+ | <pre>Array | ||
+ | ( | ||
+ | [LK12_1] => Array | ||
+ | ( | ||
+ | [0] => Array | ||
( | ( | ||
− | [0] => | + | [0] => Array |
− | [ | + | ( |
− | [1] => 3 | + | [dataclass] => attribute |
− | [ | + | [id] => 39 |
− | [2] => | + | [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 | ||
+ | ) | ||
+ | |||
) | ) | ||
) | ) | ||
+ | |||
) | ) | ||
</pre> | </pre> |
Latest revision as of 15:51, 15 November 2013
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
Contents
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
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
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
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 ) ) ) )