Code Lists Operations

Overview

Code List operations are used to manage the different lists of values used for fields of the core entities. Definition of the code lists can be found in the Data Model section of the documentation.

Important to notice is that the API works with code lists associated to core entity types and specific fields.Entities fields names are unique in Documaster Archive and are the unique identifiers of the code lists.

GET /noark5/v1/code-lists?{type,field}

The operation is used to retreive code lists values. The returned data can be filtered based on the query parameters available, by the type of the core entity and the field of the core entity for which the lists is used.

HTTP Request
Field Location Mandatory Type Description
Authorization string access token aquired as part of the authentication call, prefixed with Bearer
X-Documaster-Error-Response-Type string custom header indicating that any error should be reported in JSON format, rather than the standard text format, should always be provided as application/json
type string type of the core entity for which the code lists shoudl be returned
field string field name of the entity type for which the query is made

type and field query parameters can be used together or separately.

HTTP Response

The operation returns HTTP 200 OK in case of success or any of the standard error codes defined.

Field Location Type Description
Content-Type string content type header, always is application/json
$.results[] array list of code list values grouped by entity type
$.results[].type string core entity type for which the list is defined
$.results[].field object core entity field for which the code list is defined. NOTE : this is the element which is the unique identifier of the code list used in update/delete operations.
$.results[].defaultValue string default value object for the code list
$.results[].defaultValue.code string code of the default code list value
$.results[].defaultValue.name string name of the default code list value
$.results[].defaultValue.description string description of the default code list value
$.results[].values[] array list of values available in the code list
$.results[].values[].code string code of the default code value
$.results[].values[].name string name of the default code list value
$.results[].values[].description string description of the code list value
$.results[].values[].authority string authority for the code list value

This operation does not support pagination and limit of the number of values returned, so use it carefully, especially when the code lists contain many possible values.

      Request

GET https://v2-34-0.local.documaster.tech:8083/rms/api/public/noark5/v1/code-lists?type=Arkiv&field=dokumentmedium HTTP/1.1
...
Authorization: Bearer {{accessTokenIntegrator}}
X-Documaster-Error-Response-Type: application/json

      Response

HTTP/1.1 200 OK
...
Content-Type: application/json

{
  "results": [
    {
      "type": "Arkiv",
      "field": "dokumentmedium",
      "defaultValue": {
        "code": "E",
        "name": "Elektronisk arkiv"
      },
      "values": [
        {
          "code": "E",
          "name": "Elektronisk arkiv"
        }
      ]
    }
  ]
}
// Noark5Client is created and access token is provided

// Requesting single code list to be returned
CodeList documentMediumCodeList = client.codeLists("Arkiv", "dokumentmedium").get(0);

for (CodeValue cv : documentMediumCodeList.getValues()) {
    System.out.println("Code : " + cv.getCode() + "; Name : " + cv.getName());
}

// Requesting all code lists for Journalpost
List<CodeList> registryEntryCodeLists = client.codeLists("Journalpost", null);

for (CodeList cl : registryEntryCodeLists) {
    System.out.println("Code List : " + cl.getField() + ";");
}
// NoarkClient is created and access token is provided

// Requesting single code list to be returned
CodeList documentMediumCodeList = client.CodeLists("Arkiv", "dokumentmedium")[0];

foreach (CodeValue cv in documentMediumCodeList.Values) {
    Console.WriteLine("Code : " + cv.Code + "; Name : " + cv.Name);
}

// Requesting all code lists for Journalpost
List<CodeList> registryEntryCodeLists = client.CodeLists("Journalpost", null);

foreach (CodeList cl in registryEntryCodeLists) {
    Console.WriteLine("Code List : " + cl.Field + ";");
}

PUT /noark5/v1/code-lists/{field}/{code}

The operation is used to add or update code list values. Single code list value can be updated in a call.

HTTP Request
Field Location Mandatory Type Description
Authorization string access token aquired as part of the authentication call, prefixed with Bearer
Content-Type string content type header, should always be provided as application/json
X-Documaster-Error-Response-Type string custom header indicating that any error should be reported in JSON format, rather than the standard text format, should always be provided as application/json
field string core entity field for which the code list is being updated
code string code of the newly created/update code list value. Note that code should be unique throughout the code list.
$.name string name of the newly created/update code list value. Note that name should be unique throughout the code list.
$.description string description of the newly created/update code list value
HTTP Response

The operation returns HTTP 200 OK in case of success or any of the standard error codes defined.

Field Location Type Description
Content-Type string content type header, always is application/json
$.code array code of the newly created/update code list value
$.name string name of the newly created/update code list value
$.description object description of the newly created/update code list value

      Request

PUT https://v2-34-0.local.documaster.tech:8083/rms/api/public/noark5/v1/code-lists/dokumentmedium/PA HTTP/1.1
...
Authorization: Bearer {{accessTokenIntegrator}}
X-Documaster-Error-Response-Type: application/json
Content-Type: application/json

{
  "name" : "Paper Archive",
  "description" : "Document medium type code list value to be used for paper archives"
}

      Response

HTTP/1.1 200 OK
...
Content-Type: application/json

{
  "code": "PA",
  "name": "Paper Archive",
  "description": "Document medium type code list value to be used for paper archives"
}
// Noark5Client is created and access token is provided

// Requesting single code list to be returned
CodeList documentMediumCodeList = client.codeLists("Arkiv", "dokumentmedium").get(0);

for (CodeValue cv : documentMediumCodeList.getValues()) {
    System.out.println("Code : " + cv.getCode() + "; Name : " + cv.getName());
}

// Requesting all code lists for Journalpost
List<CodeList> registryEntryCodeLists = client.codeLists("Journalpost", null);

for (CodeList cl : registryEntryCodeLists) {
    System.out.println("Code List : " + cl.getField() + ";");
}
// NoarkClient is created and access token is provided

// Requesting single code list to be returned
CodeList documentMediumCodeList = client.CodeLists("Arkiv", "dokumentmedium")[0];

foreach (CodeValue cv in documentMediumCodeList.Values) {
    Console.WriteLine("Code : " + cv.Code + "; Name : " + cv.Name);
}

// Requesting all code lists for Journalpost
List<CodeList> registryEntryCodeLists = client.CodeLists("Journalpost", null);

foreach (CodeList cl in registryEntryCodeLists) {
    Console.WriteLine("Code List : " + cl.Field + ";");
}

DELETE /noark5/v1/code-lists/{field}/{code}

The operation is used to add or update code list values. Single code list value can be updated in a call.

HTTP Request
Field Location Mandatory Type Description
Authorization string access token aquired as part of the authentication call, prefixed with Bearer
X-Documaster-Error-Response-Type string custom header indicating that any error should be reported in JSON format, rather than the standard text format, should always be provided as application/json
field string core entity field for which the code list is being deleted
code string code of deleted code list value
HTTP Response

The operation returns HTTP 204 No Content in case of success or any of the standard error codes defined.

      Request

DELETE https://v2-34-0.local.documaster.tech:8083/rms/api/public/noark5/v1/code-lists/dokumentmedium/PA HTTP/1.1
...
Authorization: Bearer {{accessTokenIntegrator}}
X-Documaster-Error-Response-Type: application/json

      Response

HTTP/1.1 204 No Content