REST Enumeration API
All Enumerations
Returns the list of all available enumerations.
|
URL Pattern |
/enum/info |
|
Method |
GET |
|
Parameters |
No parameters are available |
|
Media type |
text/html, application/json, application/xml |
|
Result |
A list of all enumerations defined in the repository |
Result
For each enumeration the following properties are returned:
|
Key |
Data type |
Description |
|
identifier |
String |
Unique identifier of the enumeration |
|
dataType |
String |
Data type of the enumeration entry's key, see also REST Datatypes. |
|
name |
String |
Localized name of the enumeration |
|
description |
String |
Localized description of the enumeration |
Meta Data and Enumeration Entries
Returns the entries of the specified enumeration.
|
URL Pattern |
/enum/{enumeration-identifier} |
||||||||||
|
Method |
GET |
||||||||||
|
Parameters |
|
||||||||||
|
Media type |
text/html, application/json, application/xml |
||||||||||
|
Result |
The meta data of the enumeration (like the localized name) and all entries of the enumeration |
Result
The following properties are returned for an enumeration:
|
Enumeration properties |
|||
|
Field |
Data type |
Description |
|
|
identifier |
String |
Unique identifier of this enumeration |
|
|
name |
String |
Localized name of this enumeration |
|
|
description |
String |
Localized description of this enumeration |
|
|
dataType |
String |
Data type of the enumeration entry's key, see also REST Datatypes. |
|
|
entries |
Array |
List of all entries of this enumeration |
|
Each enumeration entry has the following properties:
|
Properties of a member of entries |
|||
|
Field |
Data type |
Description |
|
|
label |
String |
Unique label of this enumeration entry |
|
|
key |
String or Object |
Unique key of this enumeration entry, not necessarily human readable. In case the key is of type ENTITY_ITEM, the key is represented as proxy object containing the properties id, url and label. If XML is When creating a qualified field, this value should be used. If it is a proxy object, the value of the property id should be used. |
|
|
externalCode |
String |
External code of the enumeration entry. |
|
|
keySynonyms |
Array of Strings |
List synonyms for the entry |
|
Examples
Retrieving all enumerations
curl -u rest:heiler -H "Accept: application/json" -X GET http://localhost:1501/rest/V1.0/enum/infoThe following JSON object is returned:
{ "enumerations": [ { "identifier": "Enum.Language", "dataType": "INTEGER", "name": "All languages", "description": "" }, ...]}EnumerationInfoRequest enumInfoRequest = restClient.createEnumerationInfoRequest();EnumerationInfos allEnumInfos = enumInfoRequest.getAllEnumerations();for (EnumerationInfo enumInfo : allEnumInfos){ // ... }Retrieving the entries of enumeration Enum.Languages
curl -u rest:heiler -H "Accept: application/json" -X GET http://localhost:1501/rest/V1.0/enum/Enum.LanguageThe following JSON object is returned:
{ "identifier": "Enum.Language", "name": "All languages", "description": "", "dataType": "INTEGER", "entries": [ { "label": "Italian", "key": "16", "externalCode": "ita", "synonyms": [ "italian", "it", "ita", "ita_it" ] }, ... ]}EnumerationRequest enumRequest = restClient.createEnumerationRequest();Enumeration enumeration = enumRequest.getEnumeration( "Enum.Language" );List< EnumerationEntry > enumEntries = enumeration.getEntries();Retrieving the entries of enumeration Enum.SupplierWithMainSupplier
curl -u rest:heiler -H "Accept: application/json" -X GET http://localhost:1501/rest/V1.0/enum/Enum.SupplierWithMainSupplierThe following JSON object is returned:
(Note that the keys are in this case returned as proxy objects and the special object <main supplier> does not really exist but is a placeholder for the main supplier as specified within the HPM.)
{ "identifier": "Enum.SupplierWithMainSupplier", "name": "Suppliers (inc. main supplier)", "description": "", "dataType": "ENTITY_ITEM", "entries": [ { "label": "<Main supplier>", "key": { "id": "-10", "label": "" }, "externalCode": "", "synonyms": [] }, { "label": "TestProvider", "key": { "id": "101", "label": "TestProvider" }, "externalCode": "TestProvider", "synonyms": [] }, { "label": "Heiler Product Manager", "key": { "id": "3", "label": "Heiler Product Manager" }, "externalCode": "Heiler Product Manager", "synonyms": [] } ]}