Web Service Method: Add Custom Attribute
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 |
application/x-www-form-urlencoded
Variable | Comment |
---|---|
| The UUID or the URI supplement (textual identifier) of the project to be used. |
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 |
boolean | Value can be either |
float | Value may only contain digits or scientific notation |
integer | Value may only contain digits and must be between |
long | Value may only contain digits or scientific notation and must be between |
date | Value in ISO 8601 format. Typical pattern |
dateTime | Value in ISO 8601 format. Typical pattern |
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
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
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
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
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
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
* Escaping in http requests necessary
Character | Escape Sequence |
---|---|
+ | %2B |
- | %2D |