Patch Codeset
  • 18 Jul 2024
  • 3 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Patch Codeset

  • Dark
    Light
  • PDF

Article summary

Patch Codeset

/v1/codesets

Maintain Codeset

Example for calling:

http://server/v1/codesets
http://server/v1/codesets?owner=safransa

Request Body = {….} see request fields below

Allowed methods:

[PATCH]

API Controller: codeset

Description:

Update the single codeset with the details provided; all other details remain as is. The codeset must be present, as must the resources which are to be patched. Should the codeset ID be missing, API will attempt to identify the codeset using the name and owner. API will only allow to patch one codeset per call; it will accept to patch 0, 1 or many field types. Some details are not possible to patch. It is possible to add new field types if the given details do not already exist.

Parameters:

NameTypeDescriptionNotes
idintegerCodeset ID
network_idintegerNetwork IDMandatory when "SafranWebApiOwnerVerificationDuringApiCalls" is in use.
ownerstringOwner of the code setRelates to "SafranWebApiOwnerVerificationDuringApiCalls" in "Application Settings".
  • Combining id with network_id is not supported
  • When "SafranWebApiOwnerVerificationDuringApiCalls" is in use, the Codeset retrieved can only be linked to projects owned by the same owner as the Codeset. Should the Codeset be linked to other projects, owned by others, the API will return failure.
  • Id will be used to identify the code set; if missing, the combination of name and owner will be used.
  • It is not possible to patch a field linked to another set.
    • Unless only patching these fields:
      • visible
      • enabled
      • inherit_label
    • In the case of the patch with more than one field, where one field is prevented from being patched, the whole operation will be prevented.

Request Fields:


Syntax of the fields are similar to what is found when using GET /v1/codesets with additional elements, see codesets.

CodeSet

NameTypeDescriptionNotes
RowIdIntegerSequential number used in the communication with the API,which identifies a row in this request that lines up with the response.
idintegerId of the code set
namestringName of the codeset
OwnerstringOwner of the codeset
date_fieldsgeneric_field[]Collection of defined generic_field objects of type dateSee codesets for details
reference_fieldsreference_field[]Collection of defined reference_field objectsSee codesets for details
flag_fieldsgeneric_field[]Collection of defined generic_field objects of type flagSee codesets for details
decimal_fieldsgeneric_field[]Collection of defined generic_field objects of type decimalSee codesets for details
duration_fieldsgeneric_field[]Collection of defined generic_field objects of type durationSee codesets for details
text_fieldsgeneric_field[]Collection of defined generic_field objects of type textSee codesets for details
outline_codesoutline_code[]Collection of defined outline_code objectsSee codesets for details
  • When network_id is provided, and id is null or 0, API will attempt to get the id from the network identified with the given network_id.
  • When "SafranWebApiOwnerVerificationDuringApiCalls" as per "Application Settings" is in use, the Codeset must not exist in other networks.
  • Where id is missing, API will identify the Codeset using name and owner.
  • Reference fields only support simple reference types, not referencing other references.


Field Types:

The details can be altered using this API.

NameTypeDescriptionNotes
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
decimal_fieldsgeneric_field[]Collection of defined generic_field objects of type duration
duration_fieldsgeneric_field[]Collection of defined generic_field objects of type decimal


Restriction:

The following details cannot be patched:

NameTypeDescriptionNotes
idintegerUnique CodeSet Id
namestringProject name
ownerstringOwner (Username)
field_nrintegerReference field number.Any field_nr in any field_types cannot be modified.
_shortstringReference value short identifierThe _short value of reference_values for a reference_field cannot be modified.
outlinecodeoutline_code[]Collection of defined outline_code objects


Response Fields:

NameTypeDescriptionNotes
Config_IdIntegerConfiguration identification
RowIdIntegerLines up with the RowId in Request Fields
ResultStringIndicate the success or failure of the actionS = success, F = failure


Sample Call Patch

json result

[
   {
      "RowId":1,
      "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
         }
      ]
   }
]


Was this article helpful?