Record resource

Insert or update record field value

For a quick insert or update single record field value, use /api/records endpoint

/api/records/{recordId}/fields/{fieldId}/fields/{subfieldId}

where

  • recordId is record uuid, e.g. 517458e6-0a48-4af0-a33f-4089f87ccfda

  • fieldId is field uuid

  • subfieldId is subfield uuid

  • request body is json with value to set in value field

Example 200

Set textual value - specify string value

POST /api/records/517458e6-0a48-4af0-a33f-4089f87ccfda/fields/6a7da1b6-7958-491a-b95e-149de4ad9f39/3b5fb94b-2fd1-4922-8257-68bfe29f7c8b  HTTP/1.1
Content-Type: application/json; charset=UTF-8
Host: https://demo.kpsys.cz

{
  "value":"Headway"
}

Example 200

Set another record value - specify uuid of record (currently record.id value)

POST /api/records/517458e6-0a48-4af0-a33f-4089f87ccfda/fields/d3170435-5650-4eec-83ea-32830683d531/4c76bed8-e59e-411b-9457-ae49bd9c5e56  HTTP/1.1
Content-Type: application/json; charset=UTF-8
Host: https://demo.kpsys.cz

{
  "value":{
    "id":"fb8f6957-f17b-4f09-86e1-bdfdfd7519b8"
  }
}

Record editation resource

For a complex manipulation with record, use /api/record-editations endpoint. Firstly, create an record editation for easy fields manipulation. Then, you can add or remove new fields, add or edit field values. Each field gets own unique id. With this id you can address any of field.

Create record editation

Creates new editation session with given record

GET /api/record-editations/new?kind={kind}&fond={fond}&revisionSavingPolicy={revisionSavingPolicy}&emptyFieldsCompletion={emptyFieldsCompletion}

where

  • kind is type of record: document or authority

  • fond is id of desired record fond, e.g. 1 or 53

  • revisionSavingPolicy is policy, when to automaticly save record, possible values are

    • manual-only - system will never save record automatically - after finish editation, you will have to call save or publish

    • after-each-change-when-draft - system will save record after any change, when record is DRAFT (not published), after publish, you will have to call save manually

    • after-each-change-always - system will save record after any change automatically (no need for manual calling save or publish)

  • emptyFieldsCompletion is whether to automatic empty fields creation, true or false, default true

Example 200

POST /api/record-editations/new?kind=document&fond=1&revisionSavingPolicy=manual-only&emptyFieldsCompletion=false HTTP/1.1
Content-Type: application/json; charset=UTF-8
Host: https://demo.kpsys.cz
Content-Length: 0
{
  "id": "sP5NmmLPQVqMGG-EMxqecg",
  "text": "",
  "recordId": "1283f867-3ff8-446f-b3a1-e67ce20cd21c",
  "directoryId": 482527,
  "type": "document",
  "draft": false,
  "revisionSaved": true,
  "fond": {
    "id": 1,
    "text": "Monografie"
  },
  "fields": [
    {
      "id": "96ab9ae4-8764-4fca-9a3e-a78a76e85a30",
      "fieldRepetition": 0,
      "ind1": "0",
      "ind2": "0",
      "empty": true,
      "marcId": "245#0",
      "text": "",
      "code": "245",
      "typeId": "D.245",
      "fieldTypeText": "Údaje o názvu",
      "fields": [
        {
          "id": "4cc32a88-4246-409e-8931-850b61db1ceb",
          "value": null,
          "empty": true,
          "marcId": "245#0.a#0",
          "text": "",
          "url": false,
          "ofRecord": false,
          "raw": null,
          "recordId": null,
          "typeId": "D.245.a",
          "code": "a",
          "fieldTypeText": "Název"
        },
        {
          "id": "6324477d-3491-41ec-a77d-01371227611d",
          "value": null,
          "empty": true,
          "marcId": "245#0.b#0",
          "text": "",
          "url": false,
          "ofRecord": false,
          "raw": null,
          "recordId": null,
          "typeId": "D.245.b",
          "code": "b",
          "fieldTypeText": "Další údaje o názvu"
        },
        {
          "id": "e9ee2815-ab07-4b53-a8de-73e701e433b1",
          "value": null,
          "empty": true,
          "marcId": "245#0.c#0",
          "text": "",
          "url": false,
          "ofRecord": false,
          "raw": null,
          "recordId": null,
          "typeId": "D.245.c",
          "code": "c",
          "fieldTypeText": "Údaj o odpovědnosti atd."
        }
      ]
    }
  ]
}

Create new field

To create a new field, you must specify type of that field

PUT /api/record-editations/{recordEditationId}/fields/{fieldId}?code={fieldTypeCode}

where

  • recordEditationId is record editation, e.g. sP5NmmLPQVqMGG-EMxqecg

  • fieldId is UUIDv4 of newly creating field - generate by yourself, e.g. 6a7da1b6-7958-491a-b95e-149de4ad9f39

  • fieldTypeCode is code of created field type, e.g. 245

Example 200

PUT /api/record-editations/sP5NmmLPQVqMGG-EMxqecg/fields/6a7da1b6-7958-491a-b95e-149de4ad9f39?code=245 HTTP/1.1
Content-Type: application/json; charset=UTF-8
Host: https://demo.kpsys.cz

Create new subfield

To create a new subfield, you must specify a container field and type of that field. If subfield type is complex authority field (same authority covers multiple subfields, e.g. fields 100.a, 100.b, 100.c), use one composite code "main" (virtual composite field 100.main) in place of creating all subfields.

PUT /api/record-editations/{recordEditationId}/fields/{fieldId}/{subfieldId}?code={fieldTypeCode}

where

  • recordEditationId is record editation, e.g. sP5NmmLPQVqMGG-EMxqecg

  • fieldId is parent field uuid

  • subfieldId is UUIDv4 of newly creating subfield - generate by yourself, e.g. 3b5fb94b-2fd1-4922-8257-68bfe29f7c8b

  • fieldTypeCode is code of created subfield type, e.g. a or main

Example 200

Standard text field (code a)

PUT /api/record-editations/sP5NmmLPQVqMGG-EMxqecg/fields/6a7da1b6-7958-491a-b95e-149de4ad9f39/3b5fb94b-2fd1-4922-8257-68bfe29f7c8b?code=a HTTP/1.1
Content-Type: application/json; charset=UTF-8
Host: https://demo.kpsys.cz

Complex authority field (code main)

PUT /api/record-editations/sP5NmmLPQVqMGG-EMxqecg/fields/6a7da1b6-7958-491a-b95e-149de4ad9f39/3b5fb94b-2fd1-4922-8257-68bfe29f7c8b?code=main HTTP/1.1
Content-Type: application/json; charset=UTF-8
Host: https://demo.kpsys.cz

Update record field value

Sets new value to given field. When no field with given identifier exists, creates a new field.

Example 200

Standard text field (code a)

POST /api/record-editations/sP5NmmLPQVqMGG-EMxqecg/fields/6a7da1b6-7958-491a-b95e-149de4ad9f39/3b5fb94b-2fd1-4922-8257-68bfe29f7c8b HTTP/1.1
Content-Type: application/json; charset=UTF-8
Host: https://demo.kpsys.cz

{
  "value":"Headway"
}

Simple authority field (code a) by known record - specify its id

POST /api/record-editations/sP5NmmLPQVqMGG-EMxqecg/fields/6a7da1b6-7958-491a-b95e-149de4ad9f39/3b5fb94b-2fd1-4922-8257-68bfe29f7c8b HTTP/1.1
Content-Type: application/json; charset=UTF-8
Host: https://demo.kpsys.cz

{
  "value":{
    "id":"fb8f6957-f17b-4f09-86e1-bdfdfd7519b8"
  }
}

Simple authority field (code a) by unknown record - specify string subfield value

POST /api/record-editations/sP5NmmLPQVqMGG-EMxqecg/fields/6a7da1b6-7958-491a-b95e-149de4ad9f39/3b5fb94b-2fd1-4922-8257-68bfe29f7c8b HTTP/1.1
Content-Type: application/json; charset=UTF-8
Host: https://demo.kpsys.cz

{
  "value": {
    "fieldLabel": "Beletrie"
  }
}

Complex authority field (code main) by known record - specify its id

POST /api/record-editations/sP5NmmLPQVqMGG-EMxqecg/fields/6a7da1b6-7958-491a-b95e-149de4ad9f39/3b5fb94b-2fd1-4922-8257-68bfe29f7c8b HTTP/1.1
Content-Type: application/json; charset=UTF-8
Host: https://demo.kpsys.cz

{
  "value":{
    "id":"fb8f6957-f17b-4f09-86e1-bdfdfd7519b8"
  }
}

Complex authority field (code main) by unknown record - specify values for particular subfield codes (e.g. 100.a, 100.b, 100.c)

POST /api/record-editations/sP5NmmLPQVqMGG-EMxqecg/fields/6a7da1b6-7958-491a-b95e-149de4ad9f39/3b5fb94b-2fd1-4922-8257-68bfe29f7c8b HTTP/1.1
Content-Type: application/json; charset=UTF-8
Host: https://demo.kpsys.cz

{
  "value": {
    "fieldLabels": {
      "D.100.a": "Němcová, Božena",
      "D.100.d": "1820-1862"
    }
  }
}

Publish record editation

Publish and save finished record editation session

POST /api/record-editations/sP5NmmLPQVqMGG-EMxqecg/publish HTTP/1.1
Content-Type: application/json; charset=UTF-8
Host: https://demo.kpsys.cz

Set record catalogization phase

POST /api/records/phase

{
    record: string,
    phase: string
}

where

  • record is record uuid, e.g. 517458e6-0a48-4af0-a33f-4089f87ccfda

  • phase is desired catalogization phase, valid value is one of:

    • STUB - represent status 2

    • CATALOGING - represent status 3

    • CATALOGED - represent status 4

POST /api/records/phase HTTP/1.1
Content-Type: application/json; charset=UTF-8
Host: https://demo.kpsys.cz

{
  "record": "517458e6-0a48-4af0-a33f-4089f87ccfda",
  "phase": "STUB"
}

Set record to be visible on given department

After record is created, you hava to specify, where it can be visible. So, create record "holding" on given department.

POST /api/record-holdings HTTP/1.1
Content-Type: application/json; charset=UTF-8
Host: https://demo.kpsys.cz

{
    "record": "1283f867-3ff8-446f-b3a1-e67ce20cd21c",
    "department": 26
}

Response

{
  "savedObject": {
    "id": "6713191e-f9cc-47a7-9307-7d7cffbb0b44"
  }
}