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 contain contains comma-separated IDs of created attributes instead of just single integer value. Also please note that if attribute of some attribute 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 we created 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 futherfurther, 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 respose, 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"
    }
}



Provides access to the Term collections available in the application.

...