Page tree

Versions Compared

Key

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

...

Create attribute
RequestPOST /editor/attribute
ParamstermId Required ID of term where attribute should be created, even if not at term-level

level=(entry|language|term) Required Level that the attribute should be created for

dataType Required Type of an attribute. Can be integer or string. See filterWindow.attributes[*].(id|type) in Client app setup data response

batch=(0|1) Optional Default 0. If this param is 1, it means that batch-mode is On so termId-param can accept comma-separated term IDs

except=(0|1) Optional Default 0. This param is only applicable when batch-mode is On. Before making request with except=1 you should preliminary run term search request at least once, so the IDs of found terms except given by termId-param would be involved

Batch-mode response example: as you can see, value of inserted.id contains comma-separated IDs of created attributes instead of just single integer value. Also please note that if attribute of some dataTypeId should be unique at it's level but it already exists, the response will contain existing-prop, having newly created attrs IDs as keys and existing attrs IDs as values. In the below example response two Comment-attributes on termEntry-level for different termEntries were created, but one of affected termEntries does already have Comment-attribute with ID=2020358. All attributes created in batch-mode are set up with isDraft=1 flag in the database, so they are drafts, and they need to be confirmed further, otherwise they will be deleted by daily cron job. 

Response in case of non-batch-mode would be the same as below, except that:

  1. inserted.id would contain single value instead of comma-separated values,
  2. there would be no existing-property in response json
  3. This is not mentioned in response, but not that isDraft would be =0,
Code Block
titleResponse
collapsetrue
{
    "inserted": {
        "id": "2020477,2020478",
        "target": "",
        "value": null,
        "type": null,
        "language": null,
        "deletable": true,
        "dataTypeId": "20",
        "created": "Pavel Perminov, 09.05.2022 08:37:44",
        "updated": "Pavel Perminov, 09.05.2022 08:37:44"
    },
    "updated": "Pavel Perminov, 09.05.2022 08:37:44",
    "existing": {
        "2020478": 2020358 // "ID of draft attr": "ID of attr of the same dataTypeId already existing at the same level"
    }
}




Update attribute
RequestPUT /editor/attribute
ParamsattrId Required if draft0-param is not given. Comma separated IDs of attributes, whose values should be updated

dropId Optional Comma-separated list of IDs of draft-attributes, that should be deleted with preliminary usage of their values to spoof values of existing attributes identified by corresponding values from attrId-param

draft0 Required if attrId-param is not given. Comma-separated Ids of attributes, that currently are drafts, but

dataIndex=(value|target) Required if ALL attrs identified by attrId-param are of type xGraphic or externalCrossReference


value Required if it's a picklist-attribute

target Optional Must be valid termEntryTbxId (for termEntry-level attributes) or termTbxId (for term-level attributes)

termLang,mainLang Optional RFC5646-codes for preferred languages to return terms found by target-param. 

figure Required if ALL attrs identified by attrId-param are of type figure.

Basically, there are the following use cases for this type of requests:

  1. Single-update
    1. Non-unique attribute at it's level (e.g. of type xGraphic, externalCrossReference, crossReference and figure)
      1. xGraphic, externalCrossReference
        1. attrId
        2. dataIndex
        3. value
      2. crossReference
        1. attrId
        2. target
        3. termLang
        4. mainLang
      3. figure
        1. attrId
        2. figure
    2. Unique attribute at it's level (all other attribute types)
      1. Picklist attributes (e.g. of type processStatus, administrativeStatus, termType, grammaticalGender and others)
        1. attrId
        2. value
      2. Plaintext attributes (e.g. of type definition, source, context, geographicalUsage, subjectField and others)
        1. attrId
        2. value
  2.  Batch-update
    1. Non-unique attribute at it's level.
    2. Unique attribute at it's level


Delete attribute
RequestDELETE /editor/attribute
ParamsattrId Required ID of attribute to be deleted. Can be also be comma-separated list of attribute IDs


Code Block
languagejs
titleResponse
collapsetrue
{
    "updated": "Pavel Perminov, 09.05.2022 10:24:17"
}


Provides access to the Term collections available in the application.

...