Difference between revisions of "Linden Lab Official:Inventory API"
Rand Linden (talk | contribs) |
Rand Linden (talk | contribs) |
||
Line 188: | Line 188: | ||
===Fetch Inventory Descendents=== | ===Fetch Inventory Descendents=== | ||
'''HTTP method''': POST | |||
'''Path''': | |||
''FetchInventoryDescendentsCapURL'' | |||
Using HTTP POST, send a body containing a map with one key, 'folders', whose value is an array of maps, each with one key, 'folder_id', each of whose value is the category you want information about. | |||
The response is a map containing one key, 'folders', whose value is an array of folder structures with bonus descendents information. | |||
==== Parameters ==== | |||
Query parameters: | |||
*''folder_ids'' - map with one key, 'folders', whose value is an array of maps, each with one key, 'folder_id', each of whose value is the UUID of the category on which you want information. | |||
==== Return value ==== | |||
Returns a map with a single element, folders, which is an array with a single element that is a map with the following elements: | |||
{| class="lltable" | |||
|- | |||
! Key | |||
! Datatype | |||
! Description | |||
|- | |||
| agentid | |||
| UUID | |||
| UUID of the agent in question | |||
|- | |||
| owner_id | |||
| undef | |||
| | |||
|- | |||
| folder_id | |||
| UUID | |||
| | |||
|- | |||
| version | |||
| int | |||
| | |||
|- | |||
| descendents | |||
| int | |||
| Note typo! | |||
|- | |||
| categories | |||
| Array of category data structure | |||
| See below for elements. | |||
|- | |||
| items | |||
| Array of item data structures. | |||
| See below for elements. | |||
|} | |||
Each category data structure is a map with the following elements: {{#lst:{{PAGENAME}}|category }} | |||
Each item data structure is a map with the following elements: {{#lst:{{PAGENAME}}|item}} | |||
==== Example ==== | |||
TBD | |||
==== LLIDL ==== | |||
<python> | <python> | ||
Line 201: | Line 266: | ||
}] } | }] } | ||
</python> | </python> | ||
Revision as of 14:58, 2 November 2010
This document uses LLIDL for terse description of the HTTP POST and response bodies.
Viewer Capabilities
The Viewer receives four Inventory API capabilities. A fifth one, FetchInventoryDescendents, is deprecated by WebFetchInventoryDescendents.
Note: descendants is frequently but haphazardly misspelled as descendents in the code. Sadly, these misspellings are fixed in place due to existing widespread deployment.
WebFetchInventoryDescendents
Follows the Fetch Inventory Descendents API, fetches the agent's inventory structure.
FetchInventory
Follows the Fetch Inventory Items API, fetches the agent's items.
FetchLibDescendents
Follows the Fetch Inventory Descendents API, fetches library inventory structure.
FetchLib
Follows the Fetch Inventory Items API, fetches library inventory items.
Structures
<python>
&category = { agent_id : uuid, category_id : uuid, parent_id : uuid, name : string, type_default : int, version : int, } &item = { agent_id : uuid, item_id : uuid, parent_id : uuid, (category_id of the containing folder) asset_id : uuid, (available only for downloadable assets) name : string, desc : string, created_at : int, (timestamp) type : int, (asset type) inv_type : int, (inventory type) flags : int, (type-specific flags) permissions : &permissions, sale_info : &sale_info, } &permissions = { creator_id : uuid, owner_id : uuid, (always same as agent_id) group_id : uuid, last_owner_id : uuid, is_owner_group : bool, base_mask : int, group_mask : int, owner_mask : int, next_owner_mask : int, everyone_mask : int, } &sale_info = { sale_price : int, sale_type : int, }
</python>
Links
Item Links
Item links have inventory_type 24. The asset_id field of the item points to an item_id. When the parent category contents are retrieved, both the link item and the link target appear in the listing. Viewer must resolve the links by using the target item's information and removing the target item from the listing. Broken links, that is, a link item for which there is no corresponding target item, must be shown as broken links, allowing the user to take corrective action.
Folder Links
Folder links are represented by items with inventory_type 25. The asset_id field of the item points to a category_id. Viewers should enable viewing of the contents of the target category, while indicating that the category is a link.
API
Fetch Inventory Items
Returns information on the specified inventory items.
HTTP method: POST
Path:
FetchInventoryCapURL
Parameters
Query (POST) parameters:
- items - a map with one key, 'items', whose value is an array of maps, each with one key, 'item_id', whose value is the item you want information about.
Return value
The response is a map containing two keys, as shown in the following table.
Key | Datatype | Description |
---|---|---|
agent_id | UUID | UUID of the agent in question |
items | array | Array of item data structures. |
Each item data structure is a map with the following elements:
Return value | Datatype | Description |
---|---|---|
agent_id | UUID | |
asset_id | UUID | |
created_at | int | timestamp? |
desc | string | |
flags | integer | |
inv_type | integer | same as asset type? |
item_id | UUID | |
name | string | |
parent_id | UUID | |
permissions | Map containing Permissions | |
sale_info | Map containing Sale info | |
type | integer | asset type |
Example
TBD
LLIDL
<python>
%% FetchInventoryCapURL -> { items: [{ item_id: uuid }, ... ] } <- { agent_id: uuid, items: [ &item, ... ] }
</python>
Fetch Inventory Descendents
HTTP method: POST
Path:
FetchInventoryDescendentsCapURL
Using HTTP POST, send a body containing a map with one key, 'folders', whose value is an array of maps, each with one key, 'folder_id', each of whose value is the category you want information about.
The response is a map containing one key, 'folders', whose value is an array of folder structures with bonus descendents information.
Parameters
Query parameters:
- folder_ids - map with one key, 'folders', whose value is an array of maps, each with one key, 'folder_id', each of whose value is the UUID of the category on which you want information.
Return value
Returns a map with a single element, folders, which is an array with a single element that is a map with the following elements:
Key | Datatype | Description |
---|---|---|
agentid | UUID | UUID of the agent in question |
owner_id | undef | |
folder_id | UUID | |
version | int | |
descendents | int | Note typo! |
categories | Array of category data structure | See below for elements. |
items | Array of item data structures. | See below for elements. |
Each category data structure is a map with the following elements: {{#lst:Inventory API|category }}
Each item data structure is a map with the following elements: {{#lst:Inventory API|item}}
Example
TBD
LLIDL
<python>
%% FetchInventoryDescendentsCapURL -> { folders: [{ folder_id: uuid }, ... ] } <- { folders: [{ agent_id: uuid, owner_id: uuid, folder_id: uuid, version: int, descendents: int, (len(items) + len(categories)) categories: [ &category, ... ], items: [ &item, ... ] }] }
</python>