Difference between revisions of "Linden Lab Official:Inventory API"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with 'Category:Capabilities')
 
Line 1: Line 1:
[[Category:Capabilities]]
[[Category:Capabilities]]
= Inventory API =
== Viewer Capabilities  ==
The Viewer receives four Inventory API capabilities. They map onto specific urls in this document. A fifth capability, FetchInventoryDescendents, is a web service endpoint provided by the dataserver itself. It is deprecated by this API.''
'''Note well: ''descend<u>a</u>nts'' is frequently but haphazardly misspelled as ''descend<u>e</u>nts'' in the code. Sadly, these misspellings are fixed in place due to existing widespread deployment.'''
===WebFetchInventoryDescendents===
Follows the [[#Fetch_Inventory_Descendents|Fetch Inventory Descendents]] API, fetches the agent's inventory structure.
===FetchInventory===
Follows the [[#Fetch_Inventory_Items|Fetch Inventory Items]] API, fetches the agent's items.
===FetchLibDescendents===
Follows the [[#Fetch_Inventory_Descendents|Fetch Inventory Descendents]] API, fetches library inventory structure.
===FetchLib===
Follows the [[#Fetch_Inventory_Items|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.
==APIs==
===Fetch Inventory Items===
%% agent/{$agent_id}/inventory/fetch
-> { items: [{ item_id: uuid }, ... ] }
<- { agent_id: uuid, items: [ &item, ... ] }
===Fetch Inventory Descendents===
%% agent/{$agent_id}/inventory/fetch/descendants
-> { folders: [{ folder_id: uuid }, ... ] }
<- { folders: [{ agent_id: uuid,
                  owner_id: undef,
                  folder_id: uuid,
                  version: int,
                  descendents: int,                ; Note typo!
                  categories: [ &category, ... ],
                  items: [ &item, ... ]
              }] }

Revision as of 11:34, 29 October 2010


Inventory API

Viewer Capabilities

The Viewer receives four Inventory API capabilities. They map onto specific urls in this document. A fifth capability, FetchInventoryDescendents, is a web service endpoint provided by the dataserver itself. It is deprecated by this API.

Note well: 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.

APIs

Fetch Inventory Items

%% agent/{$agent_id}/inventory/fetch
-> { items: [{ item_id: uuid }, ... ] }
<- { agent_id: uuid, items: [ &item, ... ] }

Fetch Inventory Descendents

%% agent/{$agent_id}/inventory/fetch/descendants
-> { folders: [{ folder_id: uuid }, ... ] }
<- { folders: [{ agent_id: uuid,
                 owner_id: undef,
                 folder_id: uuid,
                 version: int,
                 descendents: int,                 ; Note typo!
                 categories: [ &category, ... ],
                 items: [ &item, ... ]
              }] }