For all the API calls, first create an object of the SDK class so that you can access the SDK functions.
To create an object of the SDK class, pass the following information to the SDK constructor:
clientKey
- obtained when you created an application in Key ManagementclientSecret
- obtained when you created an application in Key ManagementcallbackUrl
- HTTP callback address where the user can access the application. Your app must specify it exactly as you have entered it in Key Management as it is case sensitive.
$sdk = new Thingspace\Cloud\Sdk(clientKey,clientSecret,callbackUrl);
getSearch
retrieves search results matching a specified query.
Request Parameters
query
– Contains the text to be searched for and supports a number of query fields that allow clients to restrict the search to particular parts of a file’s or folder’s metadata.virtualfolder
– Folder that represents various client types at the root level and contains their respective data.sort
– Specifies the sort order for a response. Syntax is :{field} + {asc|desc}
. Valid values for the field
parameter are:start
– Page number to return, for paginated responses. Default is 1.count
- Maximum items to include in a paginated response, for folder requests. Required if start
is specified.Code Sample
try
{ $response = $sdk->getSearch($queryString,$sort, $start, $count); $response = json_decode($response->getBody()->getContents(),true); }
catch (Exception $e) {
try
{ return $e->getResponse(); }
finally { return false; }
}
Code Sample with Values
try { $response = $sdk->getSearch('test','name+desc', 1, 200); $response = json_decode($response->getBody()->getContents(),true); } catch (Exception $e) {
try
{ return $e->getResponse(); }
finally
{ return false; }
}
Example Return Response
Search queries can return objects containing words across all metadata fields or just specific fields.
{
"count": 0,
"file": [{
"name": "string",
"parentPath": "string",
"checksum": "string",
"contentAccessible": true,
"contentToken": "string",
"deleted": true,
"extension": "string",
"size": 0,
"systemAttributes": {},
"version": 0,
"versionCreated": "string",
"viewUid": [{
"type": "string",
"viewType": "string",
"uid": "string"
}],
"uri": "string",
"shareAssociation": [{
"uid": "string",
"visibility": "string",
"name": "string",
"type": "string"
}]
}],
"folder": [{
"name": "string",
"parentPath": "string",
"size": 0,
"version": 0,
"versionCreated": "string",
"count": 0,
"deleted": true,
"viewUid": [null],
"uri": "string",
"shareAssociation": [null]
}]
}
Copyright © 2015-2017, Verizon and/or its Licensors. All rights reserved.