Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Function prototype

library_resource_set (session, resource_id, resource_data)

API Version

2.6.20 and higher

Supported interfaces

SOAP, REST (Since API Version 2.6.20)

Table of Contents

Description

Excerpt

Modifies the contents of an existing LIBRARY RESOURCE object

Input

parameters:

  • session: is the session token obtained in the session_init() call

  • resource_id: is a LIBRARY RESOURCE reference. If NULL, then the function will create a new LIBRARY resource, otherwise it will modify the existing LIBRARY RESOURCE identified by the parameter 'ref'

  • resource_data: XML/JSON containing

the information

If a property of the LIBRARY RESOURCE is not specified in the resource_data

 XML

 parameter, it will not be modified. If you want to remove the value of a property,

it must

it must be specified

in the XML

with an empty value

.

Output

parameters:

  • result:

XML with all the
  • properties of the created/modified LIBRARY RESOURCE except the array of bytes

  • ErrorMsg: If any error occurs, then this value contains a description of the error translated to the current language

  • ErrorCode: If any error occurs, then this value contains any of the standard ERROR CODES

Request

...

example

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

Code Block
languagebash
library_resource_

...

set(“LCAAAAAAAAAAAA”, 344,

...

languagexml

  "<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>

...

");

...

Response

sample:

Code Block
language

...

bash
library_resource_set(“LCAAAAAAAAAAAA”, 344,
  "{
    

...

"description": "Description of the 

...

resource",
    

...

"mime_

...

type": "png",
    "filename": "image.png",
 

...

   "code": "code28",
    

...

Notes:

...

"bytes": "aasdjasd98asduhasdkjhas"
  }");

Response

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

Appsplus tabs lite macro
data{"theme":"Electric Blue","features":["titles","active","border","rounded","icons","ripples","fullscreen"],"padding":10,"height":560,"tabFont":"Atlassian","tabSize":15,"tabBold":true,"tabItalic":false,"tabUnderline":false,"tabColor":"#ffffff","tabColorBG":"#172b4d","type":"scrollable","opacity":100,"activeColor":"#ffffff","activeColorBG":"#0052cc","borderWidth":1,"borderColor":"#ebecf0","radius":5,"hoverColor":"#ffffff","hoverColorBG":"#0052cc","iconSize":"medium","iconInline":true,"iconPrimary":"#ffffff","iconSecondary":"#172b4d","separatorWidth":1,"separatorColor":"#42526E","indicatorPercent":5,"indicatorColor":"#ff5630","indicatorColorBG":"#0052cc","hide":false,"vertical":false,"preload":true,"animate":false,"uuid":"M72b041l-9","isNew":false,"loaded":false,"attachmentId":"att3327197242"}

Return Error codes

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:

  • resource_data = null

  • Any of the values provided in resource_data is not valid (e.g. an unsupported scope value)

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