- Print
- DarkLight
- PDF
Create, Update or Delete CodeSets
Article summary
Did you find this summary helpful?
Thank you for your feedback
Create, Update or Delete CodeSets
/v1/codesets
Create new code set, update or delete existing code set.
Safran Project ILAP Gateway
This API is only available in the Safran Project ILAP Gateway product.
Example for calling:
http://server/v1/codesets
http://server/v1/codesets?network_id=92
http://server/v1/codesets?network_id=92&owner=safransa
Allowed Methods:
[POST]
API Controller: CodeSet
Description:
Create new codeset is done in one single Web Service call with indicator to specify Create or Update or Delete.
API allows to add the following details:
- Date fields
- Referense fields
- Number fields
- Decimal fields
- Duration fields
- Text fields
- Outline codes
Notice that the API allows creation of Outline codes with "Create new OutlineCodes". That is still present, however this "Create codesets" will also allow creation of outline codes.
Update action
- Update does not allow updating "field_nr" of the "generic_field", "reference_field" and "outline_code".
- Identifying existing "reference_value" when performing Update is done using:
- "reference_value" "_short"
- "reference_field" "field_nr"
- "CodeSet" "id".
- In case no existing was found, it will be add the a new "reference_value".
- Identifying existing "Outline_Value" when performing Update is done using:
- "Outline_Value" "_short"
- "Outline_Codes" "field_nr"
- "CodeSet" "id".
- In case no existing was found, it will be add the a new "Outline_Value".
- Update of the "CodeSet" fields "id", "name" and "owner" are not supported.
- Update of "Outline_Value" child level, require that all parent elements of that child are present in "Request Fields".
- It is not possible to update a field linked to another set. In the case of the update with more than one field, were one field prevented to be updated, the whole operation will be prevented.
Delete action
- Delete of a codeset is prevented if there are dependencies to the codeset.
Parameters:
Name | Type | Description | Notes |
---|---|---|---|
network_id | integer | Network ID | Mandatory when "SafranWebApiOwnerVerificationDuringApiCalls" is in use, for delete and update actions. |
owner | string | Owner of the code set | Relates to the "SafranWebApiOwnerVerificationDuringApiCalls" in the "Application Settings" |
Request Fields:
Syntax of the fields are similar to what is found when using GET /v1/codesets with additional elements, see codesets.
CodeSet
Name | Type | Description | Notes |
---|---|---|---|
RowId | Integer | Sequential number used in the communication with the API, which identifies a row in this request that lines up with the response. | |
CodeSetAction | char | Action to be performed using these data, valid chartacters 'c', 'u' and 'd' | c = Create u = Update d = Delete |
UpdateIfExists | boolean | If action is create and codeset already is present, setting this to true will invoke update action instead. | |
id | integer | Id of the code set Set to null when using create action | |
name | string | Name of the codeset | |
Owner | string | Owner of the codeset | |
date_fields | generic_field[] | Collection of defined generic_field objects of type date | See codesets for details |
reference_fields | reference_field[] | Collection of defined reference_field objects | See codesets for details |
flag_fields | generic_field[] | Collection of defined generic_field objects of type flag | See codesets for details |
number_fields | generic_field[] | Collection of defined generic_field objects of type number | These are obsolete |
decimal_fields | generic_field[] | Collection of defined generic_field objects of type decimal | See codesets for details |
duration_fields | generic_field[] | Collection of defined generic_field objects of type duration | See codesets for details |
text_fields | generic_field[] | Collection of defined generic_field objects of type text | See codesets for details |
outline_codes | outline_code[] | Collection of defined outline_code objects | See codesets for details |
- When network_id is provided in the Parameters, only one CodeSet can be sent to the API.
- When network_id is provided and id is null or 0, API will attempt getting the id from the network identified with the given network_id.
- When "SafranWebApiOwnerVerificationDuringApiCalls" as per "Application Settings" is in use, the CodeSet being deleted or updated (including create with UpdateIfExists) must not exist in other networks.
- For update and delete actions where id is missing, API will identify the CodeSet using name and Owner.
- Reference_fields only support simple reference type, not referencing to other references.
Note for outline_codes
For "outline codes" "seq" and "parent_seq" are not used. When specifying the short attribute, it needs to host the full path of the item.
"outline_values": [
{
"description": "Description 1.1.1",
"_short": "Level 1.Level 2.Level 3",
"sort_field": 3,
"delimiter_char": "."
},
{
"description": "Description 1.1",
"_short": "Level 1.Level 2",
"sort_field": 2,
"delimiter_char": "."
},
{
"description": "Description 1",
"_short": "Level 1",
"sort_field": 1,
"delimiter_char": "."
}
]
Response Fields:
Name | Type | Description | Notes |
---|---|---|---|
Config_Id | Integer | Configuration identification | |
RowId | Integer | Lines up with the RowId in Request Fields | |
Result | String | Indicate the success or failure of the action | S = success, F = failure |
Sample Call Create sample
[
{
"RowId":1,
"CodeSetAction":"C",
"UpdateIfExists":false,
"id":null,
"name":"CodeSet API 11",
"Owner":"SAFRANSA",
"date_fields":[
{
"field_nr":1,
"label":"Date 1",
"visible":true,
"enabled":true
},
{
"field_nr":2,
"label":"Date 2",
"visible":true,
"enabled":true
}
],
"reference_fields":[
{
"reference_values":[
{
"description":"Ref 01",
"_short":"001"
}
],
"field_nr":1,
"label":"Reference 1 (Local Label)",
"visible":true,
"enabled":true
}
],
"flag_fields":[
{
"field_nr":1,
"label":"Flag 1",
"visible":true,
"enabled":true
},
{
"field_nr":2,
"label":"Flag 2",
"visible":true,
"enabled":true
}
],
"decimal_fields":[
{
"field_nr":1,
"label":"Decimal 1",
"visible":true,
"enabled":true
},
{
"field_nr":2,
"label":"Decimal 2",
"visible":true,
"enabled":true
},
{
"field_nr":3,
"label":"Decimal 3",
"visible":true,
"enabled":true
}
],
"duration_fields":[
{
"field_nr":1,
"label":"Duration 1",
"visible":true,
"enabled":true
},
{
"field_nr":2,
"label":"Duration 2",
"visible":true,
"enabled":true
},
{
"field_nr":3,
"label":"Duration 3",
"visible":true,
"enabled":true
}
],
"text_fields":[
{
"field_nr":1,
"label":"Text 1",
"visible":true,
"enabled":true
}
],
"outline_codes":[
{
"field_nr":1,
"label":"Outline Code 1",
"visible":true,
"enabled":true,
"oc_levels":4,
"levels":[
{
"level_nr":1,
"label":"Level 1",
"char_type":"3",
"field_length":"0",
"divider_char":"."
},
{
"level_nr":2,
"label":"Level 2",
"char_type":"3",
"field_length":"0",
"divider_char":"."
},
{
"level_nr":3,
"label":"Level 3",
"char_type":"3",
"field_length":"0",
"divider_char":"."
},
{
"level_nr":4,
"label":"Level 4",
"char_type":"3",
"field_length":"0",
"divider_char":"."
}
],
"outline_values":[
{
"description":"Description 1.1.1",
"_short":"Level 1.Level 2.Level 3",
"sort_field":3,
"seq":1,
"parent_seq":2,
"delimiter_char":"."
},
{
"description":"Description 1.1",
"_short":"Level 1.Level 2",
"sort_field":2,
"seq":2,
"parent_seq":3,
"delimiter_char":"."
},
{
"description":"Descritpion 1",
"_short":"Level 1",
"sort_field":1,
"seq":3,
"parent_seq":0,
"delimiter_char":"."
}
]
}
]
}
]
Sample Call Update sample
[
{
"RowId":1,
"CodeSetAction":"U",
"name": "UserfieldSets 002",
"owner": "SAFRANSA",
"reference_fields": [
{
"reference_values": [
{
"description": "Reference 2.1, short 02.1",
"_short": "Short 02.1",
"sort_field": 2
},
{
"description": "Reference 2.2, short 02.2",
"_short": "Short 02.2",
"sort_field": 3
}
],
"field_nr": 2,
"label": "Reference 2**",
"visible": true,
"enabled": true
}
],
"outline_codes": [
{
"oc_levels": 2,
"field_nr": 1,
"label": "Outline Code 1",
"visible": true,
"enabled": true,
"levels": [
{
"level_nr": 1,
"label": "Level 1",
"char_type": "3",
"field_length": "0",
"divider_char": "."
},
{
"level_nr": 2,
"label": "Level 2",
"char_type": "3",
"field_length": "0",
"divider_char": "."
}
],
"outline_values": [
{
"description": "Node 1 - Description",
"_short": "Node 1",
"sort_field": 1,
"level": 1,
"delimiter_char": "§"
},
{
"description": "Node 1.1 - Description",
"_short": "Node 1§Node 1.1",
"sort_field": 2,
"level": 2,
"delimiter_char": "§"
},
{
"description": "Node 1.2 - Description",
"_short": "Node 1§Node 1.2",
"sort_field": 3,
"level": 2,
"delimiter_char": "§"
}
]
}
]
}
]
Sample Call Delete sample
[
{
"RowId":1,
"CodeSetAction":"D",
"name": "UserfieldSets 002",
"owner": "SAFRANSA"
}
]
Was this article helpful?