Skip to main content

Web Service Method: Add Custom Attribute

Abstract

Web Service Method: Add Custom Attribute

Description

Adds a custom attribute to a resource.

URL: /PoolParty/api/thesaurus/{project}/addCustomAttribute

Note

Please take care that the target resource has the appropriate custom type applied for the selected attribute.

This service is the programmatic approach to the frontend based functionality, described here:Insert Custom Relations and Attributes

Request

Supported Methods

POST

Content-Type

application/x-www-form-urlencoded

Path Variables

Variable

Comment

{project}

The UUID or the URI supplement (textual identifier) of the project to be used.

HTTP Parameters

Parameter

Comment

Type

Required

resource

The resource the attribute value should be added to

String

true

property

URI of the attribute property

String

true

value

The attribute value that should be added.

Depending on the type of the attribute, different data formats are supported.

Please see table and examples below, using different types of values.

String

true

language

The attribute language (only relevant when adding labels)

String

false

Supported Custom Attribute Datatypes and Restrictions

boolean

Value can be either true or false

float

Value may only contain digits or scientific notation

integer

Value may only contain digits and must be between -2147483648 and +2147483647

long

Value may only contain digits or scientific notation and must be between -9223372036854775808 and +9223372036854775807

date

Value in ISO 8601 format. Typical pattern YYYY-MM-DD

dateTime

Value in ISO 8601 format. Typical pattern YYYY-MM-DD'T'hh:mm:ss (using server time zone) or YYYY-MM-DD'T'hh:mm:ss ±hhmm (including time zone offset)

literal

Value can contain any character, including ", <, > or newlines.

label

Value can contain any character, including ", <, > or newlines. A language tag has to be provided.

uri

Value can be a valid URI

Response

http status code: 200if OK.

Note

The service checks if operation is compatible with defined custom types. E.g. you can not add a property to a resource that has not defined type. In such cases a http status code 400 is returned, together with a message what causes the bad request error.

Request Pattern

POST
http://<server-url>/PoolParty/api/thesaurus/<projectID>/addCustomAttribute?resource=<resource-uri>&property=<property-uri>&value=<value>

Examples

Example Request Using Value Type 'integer'

POST
https://preview.poolparty.biz/PoolParty/api/thesaurus/1DE00AE5-CC5E-0001-F369-1D70DA101A99/addCustomAttribute?resource=https://preview.poolparty.biz/5.7.customschemetest/1&property=https://preview.poolparty.biz/5.7.-custom-attributes/custom-number&value=27
23901171.png

Example request using value type 'long'

POST
https://preview.poolparty.biz/PoolParty/api/thesaurus/1DE00AE5-CC5E-0001-F369-1D70DA101A99/addCustomAttribute?resource=https://preview.poolparty.biz/5.7.customschemetest/1&property=https://preview.poolparty.biz/5.7.-custom-attributes/longSingle&value=9.2e18
23901176.png

Example request using value type 'label' (including newline)

POST
https://preview.poolparty.biz/PoolParty/api/thesaurus/1DE00AE5-CC5E-0001-F369-1D70DA101A99/addCustomAttribute?resource=https://preview.poolparty.biz/5.7.customschemetest/1&property=https://preview.poolparty.biz/5.7.-custom-attributes/test-label-multiline-multi&value=and%20what%20about%0Anewlines?&language=en
23901175.png

Example request using value type 'date'

POST
https://preview.poolparty.biz/PoolParty/api/thesaurus/1DE00AE5-CC5E-0001-F369-1D70DA101A99/addCustomAttribute?resource=https://preview.poolparty.biz/5.7.customschemetest/1&property=https://preview.poolparty.biz/5.7.-custom-attributes/custom-date&value=2015-06-01
23901172.png

Example request using value type 'dateTime' (using server time zone)

POST
https://preview.poolparty.biz/PoolParty/api/thesaurus/1DE00AE5-CC5E-0001-F369-1D70DA101A99/addCustomAttribute?resource=https://preview.poolparty.biz/5.7.customschemetest/1&property=https://preview.poolparty.biz/5.7.-custom-attributes/test-dateTime-multi&value=2016-12-28T15:43:13
23901174.png

Example request using value type 'dateTime' (using +1100 as time zone offset value*)

POST
https://preview.poolparty.biz/PoolParty/api/thesaurus/1DE00AE5-CC5E-0001-F369-1D70DA101A99/addCustomAttribute?resource=https://preview.poolparty.biz/5.7.customschemetest/1&property=https://preview.poolparty.biz/5.7.-custom-attributes/test-dateTime-multi&value=2016-12-27T14:23:13%2B1100
23901173.png

* Escaping in http requests necessary

Character

Escape Sequence

+

%2B

-

%2D