Module: metadata

Copyright 2020 Parsable, Inc
API address: /api/metadata

ModuleServicesData typesConstants
metadataMetadataService
Constraints
ListOptionParams
ListOptions
Metadata
MetadataEntry
MetadataSystemKey
MetadataType
MetadataValue
MetadataValueDiff
Owner
Range

Enumerations

Enumeration: MetadataType

Type of metadata element

TEXT1 Freeform text field
NUMBER2 Numeric
LIST3 Restricted list of options
MULTI_SELECT_LIST4 Multi-select list of options

Enumeration: MetadataSystemKey

System metadata

TAGS1

Enumeration: Owner

Owning scope for metadata

ALL0 Used to request all metadata on a team; not valid on input
JOB_TEMPLATE1 Metadata item for templates and template sets
STEP3 Metadata item for steps
JOB4 Metadata item for jobs (i.e. Job Parameters)
USER5 Metadata item for users

Data structures

Union: MetadataValue

KeyFieldTypeDescriptionRequirednessDefault value
1textstringstring value; when passed in *WhereOpts, uses full text searching default
2numberdoubledouble value; when passed in *WhereOpts, uses exact number searching default
3listValuestringstring value from metadata list of options; when passed in *WhereOpts, uses exact string searching default
5listValueIdstringvalue id referring to listValue default
4selectedListValuescommon.SelectedListValuesset of string values from metadata list of options; when passed in *WhereOpts, uses string "contains" searching, e.g. searching for "A" returns all values containing "A", such as set("A"), set("A", "B"), set("A", "B", "C") ... default
6selectedListValueIdscommon.SelectedListValueIdsvalue id set referring to selectedListValues default
7datei64timestamp for metadata date default

Struct: MetadataValueDiff

KeyFieldTypeDescriptionRequirednessDefault value
1latestChangediff.Changedefault
10otherValueMetadataValueoptional

Used to indicate diff in MetadataEntries

Struct: Range

KeyFieldTypeDescriptionRequirednessDefault value
1range_startdoubleoptional
2range_enddoubleoptional

Struct: ListOptions

KeyFieldTypeDescriptionRequirednessDefault value
1optionslist<string>list of options to choose from default
2valueIdslist<string>list of value ids to uniquely identify the options optional
3systemValueIdslist<string>values seeded by a system key optional

Struct: Constraints

KeyFieldTypeDescriptionRequirednessDefault value
1rangeRangeonly for numeric type; not required optional
2listOptionsListOptionsrequired for list types (both list and multi-select list) optional

Struct: Metadata

KeyFieldTypeDescriptionRequirednessDefault value
1idstringdefault
2keystringDisplay name of metadata element default
3typeMetadataTypeType of metadata element default
4constraintsConstraintsOptional constraints for list or numeric default
5ownerOwnerOwning scope for metadata default
6createdAti64Timestamp of when the Metadata was created default
7isRequiredboolIs data required (for template metadata, before starting) default
8archivedAti64Timestamp of when the Metadata was archived, or 0 if not archived default
9updatedAti64Timestamp of when the Metadata was last updated default
10positiondoubleDisplay position, used as the sort index; if not passed in, add 1.0 to highest for team+owner optional
11defaultValueMetadataValueDefault value to display when a field is newly added or cleared. See Setting Default Values for Metadata for usage explanation. optional
12clearDefaultboolFlag to clear the default value, if previously set optional
13externallyManagedboolFlag to indicate this field is externally managed optional
14systemKeyMetadataSystemKeyType of system metadata optional

Struct: MetadataEntry

KeyFieldTypeDescriptionRequirednessDefault value
1metadataIdstringdefault
3keystringdefault
2valueMetadataValuedefault
4idValueMetadataValueoptional
5externallyManagedboolThis value is a metadata field that is externally managed optional
10referencedbooloptional

Struct: ListOptionParams

KeyFieldTypeDescriptionRequirednessDefault value
1namestringrename value optional
2positioni32move value to new position, append if -1 optional
3alphabeticalboolinsertion order optional

Optional parameters when updating list metadata values

Services

Service: MetadataService

Function: MetadataService.add

Metadata add(string teamId,
             Metadata metadata)
    throws common.SystemException
Add a metadata definition to the specified team; will assign an ID and a default position Raises BAD_REQUEST if key is not unique among unarchived metadata for the same team+owner; note that it is OK to create a new item to replace an archived one with the same key

Function: MetadataService.index

list<Metadata> index(string teamId,
                     Owner owner = Owner.ALL,
                     bool includeArchived = false,
                     bool includeExternallyManaged = false)
    throws common.SystemException
Return all metadata definitions for requested teamId and owner, optionally with archived fields

Function: MetadataService.get

Metadata get(string teamId,
             string id)
    throws common.SystemException
Return a specific metadata definition

Function: MetadataService.update

void update(string teamId,
            Metadata metadata)
    throws common.SystemException
Update a metadata definition.
Allowable update operations include: a) change key name, b) position change (re-order), c) change required-ness, d) modify range, e) change or clear default value, f) change externally-managed flag
Disallowed update operations include: f) change list values (DEPRECATED, use updateList* below for granular ops), g) change to metadata owner, h) change to metadata type (except list -> multi-select list)

Function: MetadataService.updateListAdd

list<string> updateListAdd(string teamId,
                           string metadataId,
                           list<string> values,
                           ListOptionParams params)
    throws common.SystemException
Add values to a list (or multi-select list) metadata
Append values to end of list by default. Insert into list position if params contains position, append to end of list when position=-1
Sort all values alphabetically if params contains alphabetical=true, ignoring position when set
Return added list value ids in original input order, error if metadata is not one of the list types or values already added or bad insert position

Function: MetadataService.updateListRemove

void updateListRemove(string teamId,
                      string metadataId,
                      list<string> valueIds)
    throws common.SystemException
Remove values from a list (or multi-select list) metadata
Remove values from list if they exist; active metadata list objects will remove these values automatically
Error if metadata is not one of the list types or values not found

Function: MetadataService.updateListUpdate

void updateListUpdate(string teamId,
                      string metadataId,
                      list<string> valueIds,
                      list<ListOptionParams> params)
    throws common.SystemException
Update values in a list (or multi-select list) metadata
Update value names if params contains name; active metadata list objects will update value names automatically
Move values to list position if params contains position, move to end of list when position=-1
Sort all values alphabetically if any params contains alphabetical=true, ignoring all position when set
Error if metadata is not one of the list types or values not found or bad move position
Note that multi-move position is not supported unless all params have the same position (bulk move).

Function: MetadataService.updateListMerge

void updateListMerge(string teamId,
                     string metadataId,
                     list<string> valueIds,
                     string mergedValueId)
    throws common.SystemException
Merge values in a list (or multi-select list) metadata
Merge values into a single existing value; active metadata list objects will update all merged values to final value automatically
Error if metadata is not one of the list types or values/merged value not found

Function: MetadataService.archive

void archive(string teamId,
             string id)
    throws common.SystemException
Archive a metadata definition; this allows access to the metadata on existing owners, but prevents new users of the metadata

Function: MetadataService.updateMetadataAttributes

list<abac.AbacAttribute> updateMetadataAttributes(common.UUID teamId,
                                                  common.UUID metadataId,
                                                  list<abac.AbacAttribute> attributes,
                                                  abac.AbacUploadBehaviour behave)
    throws common.SystemException
update Metadata Attributes provide teamId to prevent extra lookups

Function: MetadataService.updateMetadataAttribute

list<abac.AbacAttribute> updateMetadataAttribute(common.UUID teamId,
                                                 common.UUID metadataId,
                                                 common.UUID attributeId,
                                                 list<abac.AbacAttributeValue> values,
                                                 abac.AbacUploadBehaviour behave)
    throws common.SystemException
update a Metadata abac actor with a single Attribute provide teamId to prevent extra lookups

Function: MetadataService.updateMetadataValueAttributes

list<abac.AbacAttribute> updateMetadataValueAttributes(common.UUID teamId,
                                                       common.UUID metadataId,
                                                       list<abac.AbacAttribute> attributes,
                                                       abac.AbacUploadBehaviour behave)
    throws common.SystemException
update a Metadata Value abac actor with Attributes provide teamId to prevent extra lookups

Function: MetadataService.updateMetadataValueAttribute

list<abac.AbacAttribute> updateMetadataValueAttribute(common.UUID teamId,
                                                      common.UUID metadataId,
                                                      common.UUID attributeId,
                                                      list<abac.AbacAttributeValue> values,
                                                      abac.AbacUploadBehaviour behave)
    throws common.SystemException
update Metadata Value with a single Attribute provide teamId to prevent extra lookups