CodeSets
  • 22 Aug 2024
  • 5 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

CodeSets

  • Dark
    Light
  • PDF

Article summary

Codeset Configuration

/v1/codesets/{id}

Codeset Configuration

Example for calling:

http://server/v1/codesets/9 - retrieves codeset related to network with network Id = 9

http://server/v1/codesets?id=1 - retrieves codeset having Id = 1

http://server/v1/codesets?network_id=9 - retrieves codeset related to network with network id = 9

http://server/v1/codesets?network_id=9&meta_field_select=DLF - retrieves codeset related to network with network id = 9 limited to date, flag and text fields

http://server/v1/codesets?network_id=9&meta_field_select=D,L,F - retrieves codeset related to network with network id = 9 limited to date, flag and text fields

http://server/v1/codesets?network_id=9&meta_field_select=R1,R2,D - retrieves codeset related to network with network id = 9 limited to R field 1 and 2 and all date fields

http://server/v1/codesets - retrieves all codesets

Allowed Methods:

[GET]
API Controller: Codeset

Description:

Retrieves the configuration detail for specified codeset or all codesets if no ID is specified. Only defined userfields are included.

Codeset and master codeset

A definition of a "codeset" could be connected to another "codeset", here referred to as a "master codeset". When requesting details for a "code set" connected to a "master codeset", the "reference value" will be retrieved from the "master codeset". The "reference fields" values will be retrieved from the "codeset". When a "codeset" is not connected to other codesets, all values will be retrieved from the "codeset" it selves.

Parameters:

NameTypeDescriptionNotes
idintegerCodeset ID
network_idintegerNetwork IDMandatory when "SafranWebApiOwnerVerificationDuringApiCalls" is in use.
ownerstringOwner of the code setRelates to "SafranWebApiOwnerVerificationDuringApiCalls" in Application Settings
meta_field_selectstringList of fields to include in the response, see Response FieldsIf empty or missing, all fields will be included.
D = All date_fields
F = All text_fields
L = All flag_fields
N = All decimal_fields
O = All outline_codes
R = All reference_fields
U = All duration_fields
0 = Do not include any of the above elements.
Dx = Date field number x
Fx = Text field number x
Lx = Flag field number x
Nx = Decimal field number x
Ox = Outline code number x
Rx = Reference field number x
Ux = Duration field number x
ExcludeValues = Suppress details as "outline_codes.outline_values" and "reference_fields.reference_values"
  • Combining id with network_id is not supported
  • When "SafranWebApiOwnerVerificationDuringApiCalls" is used, the CodeSet retrieved can only be linked to projects owned by the same owner as the CodeSet. Should the CodeSet be linked to other projets, owned by others, the API will return failure. Unless meta_field_select=0.
  • When meta_field_select=0 and the "SafranWebApiOwnerVerificationDuringApiCalls" are in use, the owner is mandatory, but neither of the IDs is.
  • When specifying meta_field_select and leaving out some fields, the JSON will still contain the fields left out. The element for the fields left out will be empty.
  • When specifying meta_field_select with "ExcludeValues", the "outline_code" will contain empty "outline_values[]" and the "reference_field" will contain empty "reference_value[]" elements.
  • When specifying meta_field_select with the combination of "ExcludeValues" and "0" as in "0, ExcludeValues" makes no sense and will be responded with "Bad Request".

Response Fields:

NameTypeDescriptionNotes
idintegerUnique CodeSet Id
namestringProject name
ownerstringOwner (Username)
reference_fieldsreference_field[]Collection of defined reference_field objects
text_fieldsgeneric_field[]Collection of defined generic_field objects of type text
date_fieldsgeneric_field[]Collection of defined generic_field objects of type date
flag_fieldsgeneric_field[]Collection of defined generic_field objects of type flag
number_fieldsgeneric_field[]Collection of defined generic_field objects of type numberThese are obsolete since 7.1.00, 30 June 2016.
decimal_fieldsgeneric_field[]Collection of defined generic_field objects of type decimal
duration_fieldsgeneric_field[]Collection of defined generic_field objects of type duration
outline_codesgeneric_field[]Collection of defined outline_code objects



Reference Fields:

NameTypeDescriptionNotes
field_nrintegerReference field number
labelstringField label of this field
reference_valuesreference_value[]Collection of defined reference_value objects
visiblebooleanTell if field is visible, values true or false
enabledbooleanTell if field is enabled, values true or false
inherit_labelbooleanTell if (true) the label is inherited from the master set. It will be shown in Safran UI. Else (false) the label of this field will shown.The default value is false



Reference Value:

NameTypeDescription
_shortstringReference value short identifier
descriptionstringReference value description
sort_fieldintegerSort order of the reference_value[]


Example for reference fields and reference_values

API Methods CodeSets Userfield Config

API Methods CodeSets Reference Fields


Generic Field:

NameTypeDescriptionNotes
field_nrintegerReference field number
labelstringThis fields' label
visiblebooleanTell if field is visible, values true or false
enabledbooleanTell if field is enabled, values true or false
inherit_labelbooleanTell if (true) the label is inherited from the master set. It will be shown in Safran UI. Else (false), the label of this field will shown.The default value is false


This generic field structure is present where generic user fields have been defined in the codeset (date_fields, decimal_fields, duration_fields, flag_fields, number_fields, or text_fields).

number fields are no longer used in Safran 7. Decimal fields are used instead.


outline_code:

NameTypeDescriptionNotes
field_nrintegerReference field number
labelstringField label
oc_levelsintegerNumber of maximum levels of depth in outline
levelslevel[]Collection of defined outline_code levels
outline_valuesoutline_value[]Collection of defined outline_code values
visiblebooleanTell if field is visible, values true or false
enabledbooleanTell if field is enabled, values true or false
inherit_labelbooleanTell if label is inherited from the master set.

Level:

NameTypeDescription
level_nrintoutline level number
labelstringoutline level label
char_typeintegerCharacter type of level’s short value. Possible types: Any character, Uppercase, Lowercase, Numeric
field_lengthintegerLength of level’s short value. Possible lengths: Any, 1, 2, 3, 4, 5
divider_charstringCharacter separating level from next level when displaying full path.
Possible values: '.' ';' ':' '*' '\' '+' '-'


Outline_Value:

NameTypeDescriptionNotes
descriptionstringoutline value description
_shortstringoutline value code
seqintegeroutline value sequence value
parent_seqintegerRefers to a seq which acts as a parent for this outline value. 0 means no parent.
levelintegerLevel of the item in the hierarchy list. Level = 1 means root level.
delimiter_charcharDelimiter character separates the short elements in a string of full path items.This is used to communicate between the caller and API.
This cannot be set to the same as "divider_char" as found in "Level".
The API will use '§' as delimiter_char in GET calls..


Example for outline Code fields

API Methods Outline Codes

API Methods Outline Codes 2


Sample JSON Response

json result

[
  {
    "date_fields": [
    ],
    "flag_fields": [
    ],
    "number_fields": [
    ],
    "decimal_fields": [
    ],
    "duration_fields": [
    ],
    "outline_codes": [
    ],
    "id": 1,
    "name": "Safran Software Solutions AS - 1",
    "owner": "SAFRANSA",
    "reference_fields": [
      {
        "reference_values": [
          {
            "description": "Procurement (Master)",
            "_short": "PO (M)"
            
          }
          
        ],
        "field_nr": 1,
        "label": "API Test.R1 (Local)",
        "inherit_label": false,
        "visible": true,
        "enabled": true
        
      }
      
    ],
    "text_fields": [
      {
        "field_nr": 1,
        "label": "ABC Activity Code",
        "visible": true,
        "enabled": true
        
      },
      {
        "field_nr": 2,
        "label": "DEF no",
        "visible": true,
        "enabled": true
        
      }
      
    ]
    
  }
]


Was this article helpful?

ESC

Eddy AI, facilitating knowledge discovery through conversational intelligence