Function prototype | library_resource_set (session, resource_id, resource_data) |
---|---|
API Version | 2.6.20 and higher |
SOAP, REST (Since API Version 2.6.20) |
Modifies the contents of an existing LIBRARY RESOURCE object |
Input parameters: |
If a property of the LIBRARY RESOURCE is not specified in the resource_data parameter, it will not be modified. If you want to remove the value of a property, it must be specified with an empty value |
Output parameters: |
|
The function can be called expressing the resource_data parameter in XML format or JSON format. The following examples are the same. The only difference is the format of the resource_data parameter.
Remember that the byte contents of the resource must be Base64 encoded. Otherwise an error will be returned
library_resource_set(“LCAAAAAAAAAAAA”, 344, "<library_resource> <description>Description of the resource</description> <mime_type>png</mime_type> <filename>image.png</filename> <code>code28</code> <bytes>aasdjasd98asduhasdkjhas</bytes> <library_resource>"); |
library_resource_set(“LCAAAAAAAAAAAA”, 344, "{ "description": "Description of the resource", "mime_type": "png", "filename": "image.png", "code": "code28", "bytes": "aasdjasd98asduhasdkjhas" }"); |
The response format is XML when the function has been invoked via the SOAP API, and JSON when it has been invoked via the REST API
ERROR CODE | |
---|---|
INVALID_TOKEN | The session token provided is not valid |
INSUFFICIENT_PRIVILEGES | The session user does not have the necessary privileges to use the requested resource. Normally this means that it is trying to generate a 'GLOBAL' scoped object but the Session user is not a System Administrator |
WRONG_PARAMS | Any of the parameters supplied is invalid. The following situations will generate this error:
|
XML_ERROR | The format of the resource_data parameter is not a valid XML |
LIBRARY_RESOURCE.NOT_FOUND | The resource_id parameter is not an existing LIBRARY RESOURCE reference |
LIBRARY_RESOURCE.BASE64ENCODING_EXPECTED | The bytes of the resource are expected to be Base64 encoded, but an invalid string has been supplied |