Return all field data for a given resource
Param1 | $resource | The ID of the resource. |
---|
JSON containing the resource metadata.
Create a new resource.
Param1 | $resource_type | The ID of the resource type for the new resource (e.g. 1=Photo). |
---|---|---|
Param2 | $archive | The archival state of the new resource (0=live). |
Param3 | $url | Optional; v8.1 and above The URL of a file to upload. ResourceSpace will copy the file to the local system then import it to the specified resource. |
Param4 | $no_exif | Optional; v8.1 and above Do not process embedded metadata. Leave blank for the default (to process data). |
Param5 | $revert | Not currently used, leave blank. |
Param6 | $autorotate | Optional; v8.1 and above Automatically rotate (correct) images if the rotation flag is set on the image. |
Param7 | $metadata | Optional; v8.1 and above The metadata to add. A JSON encoded array of field ID to value string pairs. See the example in api/example.php. |
The ID of the newly created resource.
Set the value of a metadata field.
Param1 | $resource | The ID of the resource. |
---|---|---|
Param2 | $field | The numeric ID or shortname of the field. |
Param3 | $value | The value to set the field to. Can be a comma separated list for fixed list option fields. Use double quotes to enclose strings and use backslash as the escape character. NOTE If passing option (node) IDs ensure that the next parameter $nodevalues is set to TRUE |
Param4 | $nodevalues | Set to TRUE if passing in values as a comma separated list of field option IDs retrieved via get_field_options(). |
The operation success (true/false).
Delete a resource.
Param1 | $resource | The ID of the resource. |
---|
The operation success (true/false).
Copy a resource. Note that the attached file(s) are not copied - this is a metadata and property copy only.
Param1 | $from | The ID of the resource to copy. |
---|---|---|
Param2 | $resource_type | The ID of the resource type for the new resource. |
The ID of the newly created resource, or false if the operation failed.
Returns the full log for the resource.
Param1 | $resource | The ID of the resource. |
---|---|---|
Param2 | $fetchrows | How many rows to return. Leave blank for all rows. |
The resource log entries.
Changes the resource type of a resource (e.g. photo to video).
Param1 | $resource | The ID of the resource. |
---|---|---|
Param2 | $resourcetype | The new resource type ID. |
The operation success (true/false).
Returns a URL or file path for a resource file.
Param1 | $resource | The ID of the resource or (from v8.1 and above) an array of resource IDs. Note: when an array of IDs is passed, make sure the array is a subset of resource IDs grouped by extension, size and other parameters required by get_resource_path() in order to get the expected path returned. Example: if you are requesting the original file path of two resources, an image and a video, and your are requesting extension "jpg" then the video path will be incorrect as that was supposed to have a "mp4" extension instead (or any other video extension). |
---|---|---|
Param2 | $getfilepath | Should a file path be returned instead of a URL? |
Param3 | $size | The ID for the size requested (e.g. "scr" for screen size). Leave empty for the original file. |
Param4 | $generate | If the path does not yet exist on disk, create it. |
Param5 | $extension | The file extension requested. This can be found from the extension property of the search results or resource data queries. |
Param6 | $page | Which page to return, in the case of a request for a preview of a multi-page document. Leave empty for the first page. |
Param7 | $watermarked | Fetch a watermarked version of the image? Leave empty for non-watermarked. |
Param8 | $alternative | The ID of an alternative file to return. Leave empty for the original file. |
The requested path to the resource file, or false if there was an issue. If Param1 is an array of IDs then the returned value will be an array with resource ID as index and its path as value.
Returns the top level property data for the resource. For the metadata, use get_resource_field_data().
Param1 | $resource | The ID of the resource. |
---|
The resource properties. Actual values depend on system configuration.
Returns a list of alternative files for the given resource.
Param1 | $resource | The ID of the resource. |
---|---|---|
Param2 | $orderby | Which column to use for the ordering. Leave empty for the default order. |
Param3 | $sort | "asc" or "desc". |
A list of alternative files.
Returns all configured resource types available to this user.
No parameters.
The configured resource types.
[{"ref":"1","name":"Photo","allowed_extensions":"","order_by":"","config_options":"","tab_name":"","push_metadata":""},{"ref":"2","name":"Document","allowed_extensions":"","order_by":"","config_options":"","tab_name":"","push_metadata":""},{"ref":"3","name":"Video","allowed_extensions":"","order_by":"","config_options":"","tab_name":"","push_metadata":""},{"ref":"4","name":"Audio","allowed_extensions":"","order_by":"","config_options":"","tab_name":"","push_metadata":""}
Adds a new alternative file.
Param1 | $resource | The ID of the resource. |
---|---|---|
Param2 | $name | A short descriptive name for the new alternative file. |
Param3 | $description | A more verbose description. |
Param4 | $file_name | The file name of the new alternative file. |
Param5 | $file_extension | The extension of the new alternative file. |
Param6 | $file_size | The size of the alternative file in bytes |
Param7 | $alt_type | Used as a tag that in conjunction with configuration $alt_types_organize will group up and organize the display of alternative files |
Param8 | $file |
Optional; v8.1 and above
Alternative file location to copy over to ResourceSpace. Can be a physical path or URL. |
The ID of the new alternative file or false on failure.
Returns all configured resource types available to this user.
No parameters.
The configured resource types.
[{"ref":"1","name":"Photo","allowed_extensions":"","order_by":"","config_options":"","tab_name":"","push_metadata":""},{"ref":"2","name":"Document","allowed_extensions":"","order_by":"","config_options":"","tab_name":"","push_metadata":""},{"ref":"3","name":"Video","allowed_extensions":"","order_by":"","config_options":"","tab_name":"","push_metadata":""},{"ref":"4","name":"Audio","allowed_extensions":"","order_by":"","config_options":"","tab_name":"","push_metadata":""}
Adds a new alternative file.
Param1 | $resource | The ID of the resource. |
---|---|---|
Param2 | $name | A short descriptive name for the new alternative file. |
Param3 | $description | A more verbose description. |
Param4 | $file_name | The file name of the new alternative file. |
Param5 | $file_extension | The extension of the new alternative file. |
Param6 | $file_size | The size of the alternative file in bytes |
Param7 | $alt_type | Used as a tag that in conjunction with configuration $alt_types_organize will group up and organize the display of alternative files |
Param8 | $file |
Optional; v8.1 and above
Alternative file location to copy over to ResourceSpace. Can be a physical path or URL. |
The ID of the new alternative file or false on failure.
Deletes an alternative file.
Param1 | $resource | The ID of the resource. |
---|---|---|
Param2 | $ref | The ID of the alternative file. |
The success of the operation (true/false).
Uploads a new local file to an existing resource, replacing any file that is already attached.
Param1 | $resource | The ID of the resource. |
---|---|---|
Param2 | $no_exif | Do not process embedded metadata. Leave blank for the default (to process data). |
Param3 | $revert | Do not upload a new file, but reprocess the existing file as if it has been uploaded again. Useful for re-processing embedded metadata, e.g. after changing the field mappings. |
Param4 | $autorotate | Automatically rotate (correct) images if the rotation flag is set on the image. |
Param5 | $file_path | The path on disc, local to the server, of the file to upload. |
The operation success (true/false).
Uploads a new remote file to an existing resource, replacing any file that is already attached.
Param1 | $resource | The ID of the resource, which must already exist (see create_resource()). |
---|---|---|
Param2 | $no_exif | Do not process embedded metadata. Leave blank for the default (to process data). |
Param3 | $revert | Do not upload a new file, but reprocess the existing file as if it has been uploaded again. Useful for re-processing embedded metadata, e.g. after changing the field mappings. |
Param4 | $autorotate | Automatically rotate (correct) images if the rotation flag is set on the image. |
Param5 | $url | The URL of the file to upload. ResourceSpace will copy the file to the local system then import it to the specified resource. |
The operation success (true/false).
Returns a list of resources that are related to a resource.
Param1 | $resource | The ID of the resource. |
---|
A list of related resources.
Retrieve recent entries from the resource log v8.6 and above
Param1 | $minref | The minimum ref (id) of the log entry to retrieve |
---|---|---|
Param2 | $days | Number of recent days entries to return. Default = 7 (this is ignored if minref is supplied). |
Param3 | $maxrecords | Maximum number of records to return. Default = all rows (0) |
Log entries in JSON format, including date, ref, resource, type (refer to definitions.php) , resource_type_field, user ID, notes, diff and usageoption value
Returns a list of the user's collections.
There are no parameters.
Add a resource to a collection.
Param1 | $resource | The ID of the resource. |
---|---|---|
Param2 | $collection | The ID of the collection to add the resource to. |
True or false depending on operation success.
Remove a resource from a collection.
Param1 | $resource | The ID of the resource. |
---|---|---|
Param2 | $collection | The ID of the collection to remove the resource from. |
True or false depending on operation success.
Create a new collection for the user.
Param1 | $name | The name of the collection. |
---|
True or false depending on operation success.
Deletes a collection. The user must have write access to this collection.
Param1 | $collection | The ID of the collection. |
---|
True or false depending on operation success.
Search public and featured collections.
Param1 | $search | The search terms. Leave blank to return all collections. |
---|---|---|
Param2 | $order_by | The column to order the results by. |
Param3 | $sort | Sort order. Either "ASC" or "DESC". |
Param4 | $exclude_themes | Should featured collections (themes) be excluded from the results? |
Param5 | $exclude_public | Should public collections be excluded from the results? |
A list of matching public or featured collections.
Perform a search and return the matching resources.
Param1 | $search | The search string in the standard ResourceSpace format. |
---|---|---|
Param2 | $restypes | A string of resource type IDs to include e.g. "1,2". Leave empty to return resources of all types. |
Param3 | $order_by | A string indicating results order. Valid options are relevance, popularity, rating, date, colour, countr, title, file_path, resourceid, resouretype, titleandcountry, random, status. Leave empty for relevance ordering. |
Param4 | $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. |
Param5 | $fetchrows | Maximum number of rows to return. Leave blank to return all rows. |
Param6 | $sort | Sort order, "asc"=ascending, "desc"=descending (default). |
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"} ]
Perform a search and return matching resources including URLs for the requested preview sizes. (ResourceSpace 8.1 +)
Param1 | $search | The search string in the standard ResourceSpace format. |
---|---|---|
Param2 | $restypes | A string of resource type IDs to include e.g. "1,2". Leave empty to return resources of all types. |
Param3 | $order_by | A string indicating results order. Valid options are relevance, popularity, rating, date, colour, countr, title, file_path, resourceid, resouretype, titleandcountry, random, status. Leave empty for relevance ordering. |
Param4 | $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. |
Param5 | $fetchrows | Maximum number of rows to return. Use "-1" to return all rows. |
Param6 | $sort | Sort order, "asc"=ascending, "desc"=descending (default). |
Param7 | $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). |
Param8 | $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). |
Param9 | $previewext | Return preview files matching this file extension. e.g. "mp4", "jpg" (default). |
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":"http:\/\/imagelibrary.resourcepace.com\/filestore\/1\/1\/3\/2\/2\/9_916fb06cda226ee\/113229thm_7fe1c8566474a07.jpg?v=2017-03-01+14%3A02%3A17", "url_pre":"http:\/\/imagelibrary.resourcepace.com\/filestore\/1\/1\/3\/2\/2\/9_916fb06cda226ee\/113229pre_e2d041035b30bf5.jpg?v=2017-03-01+14%3A02%3A17", "url_col":"http:\/\/imagelibrary.resourcepace.com\/filestore\/1\/1\/3\/2\/2\/9_916fb06cda226ee\/113229col_3272c919ca5e1a0.jpg?v=2017-03-01+14%3A02%3A17" } ]
For a given field, return all the available keywords (nodes) or selectable options.
Param1 | $ref | The ID or shortname of the field |
---|---|---|
Param2 | $nodeinfo | (Version 8.6 +) Provides extended field option information if set to TRUE. Default FALSE |
A list of the options for the field, for example, for a country field this would be a list of countries.
If $nodeinfo is TRUE, each field will return
Create a new node (option for a fixed list field) v8.6 and above
The ID of the newly created (or existing) node .
Add all node IDs (field options) in the list to a resource. v8.6 and above
Param1 | $resourceid | The ID of the resource to add nodes to |
---|---|---|
Param2 | $nodes | List of node IDs to add (comma separated) |
True or false depending on operation success.
Add all node IDs (field options) in the list to the resources specified. v8.6 and above
Param1 | $resourceid | List of resource IDs to add nodes to (comma separated) |
---|---|---|
Param2 | $nodes | List of node IDs to add (comma separated) |
True or false depending on operation success.