search_get_previews

Perform a search and return matching resources including URLs for the requested preview sizes.

Variable Description Data type Default value
$search * The search string in the standard ResourceSpace format. string  
$restypes A string of resource type IDs to include e.g. "1,2". Leave empty to return resources of all types. string ""
$order_by A string indicating results order. Valid options are relevance, popularity, rating, date, colour, country, title, file_path, resourceid, resouretype, titleandcountry, random, status. Leave empty for relevance ordering. string "relevance"
$archive The archive status of resources to return. 0=live assets (the default), 1=pending archive, 2=archived, 3=deleted, -1=pending review, -2 = pending submission. integer 0
$fetchrows Maximum number of rows to return. Use "-1" to return all rows.

From version 10.2 this also supports passing an offset and limit as 2 comma separated values e.g. "0,50", with the offset as the first element and the limit (number of rows to return) as the second parameter.1
integer -1
$sort Sort order, "asc"=ascending, "desc"=descending (default). string "desc"
$recent_search_daylimit If performing a 'recent' special search, limit the results to resources created in the last n number of days. 'n'=resources from the last n days, '' = no limit (default). string ""
$getsizes Comma separated list of preview sizes e.g. "thm, scr"' will retrieve the thumbnail and screen sized previews, "" = don't return any preview URLs (default). string ""
$previewext Return preview files matching this file extension. e.g. "mp4", "jpg" (default). string "jpg"

Return values

The resource results in JSON format. The parameters returned will depend on system configuration.

[
{"score":"0",
"ref":"38",
"resource_type":"1",
"has_image":"0",
"is_transcoding":"0",
"hit_count":"0",
"creation_date":"2016-08-09 14:00:05",
"rating":"",
"user_rating":"",
"user_rating_count":"",
"user_rating_total":"",
"file_extension":"jpg",
"preview_extension":"jpg",
"image_red":"",
"image_green":"",
"image_blue":"",
"thumb_width":"",
"thumb_height":"",
"archive":"0",
"access":"0",
"colour_key":"",
"created_by":"1",
"file_modified":"2016-08-09 14:00:05",
"file_checksum":"",
"request_count":"0",
"new_hit_count":"0",
"expiry_notification_sent":"0",
"preview_tweaks":"0|1",
"file_path":"",
"group_access":"",
"user_access":"",
"field12":"2016-08-09 12:59",
"field8":"Example Photo",
"field3":"Lebanon",
"url_thm":"https:\/\/imagelibrary.resourcepace.com\/filestore\/1\/1\/3\/2\/2\/9_916fb06cda226ee\/113229thm_7fe1c8566474a07.jpg?v=2017-03-01+14%3A02%3A17",
"url_pre":"https:\/\/imagelibrary.resourcepace.com\/filestore\/1\/1\/3\/2\/2\/9_916fb06cda226ee\/113229pre_e2d041035b30bf5.jpg?v=2017-03-01+14%3A02%3A17",
"url_col":"https:\/\/imagelibrary.resourcepace.com\/filestore\/1\/1\/3\/2\/2\/9_916fb06cda226ee\/113229col_3272c919ca5e1a0.jpg?v=2017-03-01+14%3A02%3A17"
}
]

Notes
1 If the $fetchrows parameter is passed as comma separated list in order to specify an offset and number of rows to return then the results will be returned in structured array form as below:

  • A 'total' element with the total number of rows that would have been returned if no offset or limit had been specified
  • A 'data' element containing the search results as normal