This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Working with Shared Items in Box
The getSharedItem
operation is used to retrieve the metadata about a shared item when only a shared link is given. Because of varying permission levels for shared links, a password may be required to retrieve the shared item. Once the item has been retrieved, you can make API requests against the actual resource (/files/{id}
or /folders/{id}
as long as the shared link and optional password are in the header.
<box.getSharedItem> <sharedLink>{$ctx:sharedLink}</sharedLink> <sharedLinkPassword>{$ctx:sharedLinkPassword}</sharedLinkPassword> </box.getSharedItem>
Properties
sharedLink:
Required - The shared link for this item.sharedLinkPassword:
The password for this shared link.
Sample request
Following is a sample REST request that can be handled by the getShareditem operation.
{ "apiUrl":"https://api.box.com", "accessToken":"YQWXtCB6kfOxydJeX6S5ogCoxWJN8Hbk", "sharedLink":"https://app.box.com/s/ajcjoha1w45ql4sq6nls", "sharedLinkPassword":"123456" }
Related Box documentation
http://developers.box.com/docs/#shared-items-get-a-shared-item
Sample configuration
Following is a sample proxy service that illustrates how to connect to Box with the init operation and use the getSharedItem operation. The sample request for this proxy can be found in getSharedItem sample request.
As a best practice, create a separate sequence for handling the response payload for errors. In the following sample, this sequence is "faultHandlerSeq". For more information, see Configuring the Box Fault Handler Sequence.
<?xml version="1.0" encoding="UTF-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="box_getSharedItem" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> <target> <inSequence onError="faultHandlerSeq"> <property name="apiUrl" expression="json-eval($.apiUrl)"/> <property name="accessToken" expression="json-eval($.accessToken)"/> <property name="fields" expression="json-eval($.fields)"/> <property name="sharedLink" expression="json-eval($.sharedLink)"/> <property name="sharedLinkPassword" expression="json-eval($.sharedLinkPassword)"/> <box.init> <accessToken>{$ctx:accessToken}</accessToken> <apiUrl>{$ctx:apiUrl}</apiUrl> <fields>{$ctx:fields}</fields> </box.init> <box.getSharedItem> <sharedLink>{$ctx:sharedLink}</sharedLink> <sharedLinkPassword>{$ctx:sharedLinkPassword}</sharedLinkPassword> </box.getSharedItem> <property name="messageType" value="application/json" scope="axis2"/> <filter source="$axis2:HTTP_SC" regex="^[^2][0-9][0-9]"> <then> <property name="ERROR_CODE" expression="$axis2:HTTP_SC"/> <switch source="$axis2:HTTP_SC"> <case regex="401"> <property name="ERROR_MESSAGE" value="Unauthorized"/> <property name="error_description" expression="json-eval($.message)"/> <sequence key="faultHandlerSeq"/> </case> </switch> </then> </filter> <respond/> </inSequence> <outSequence> <send/> </outSequence> </target> <description/> </proxy>