Update

Used to update an existing record of a data model.

URL : /api/v1/form/<id:integer>

Example. /api/v1/form/4133?name=section

URL Parameters :

  • name=[string] : data model name
  • id=[integer] : id of an existed data model record

Method : PUT

Auth required : YES

Permissions required

  • Roles: _administrator_, developer, operator
  • Permissions: form-<data model name>:edit

Data constraints Depends on the data model. These constraints are defined in the data model class usually under rules(). Check Yii2 - Validating Input (opens new window)

Data example

Depends on the data model structure. An object that represents a table row (Model Instance) should be sent as pairs of the field name and corresponding values.

ListValue item update example

{
  "core_catcher": 1
}
1
2
3

Success Response

PUT /api/v1/form/314?name=cores

Code : 200 OK

Content example The updated record

{
  "rqd_abundance": 0,
  "rqd_intensity": 0,
  "id": 4133,
  "hole_id": 205,
  "core": 35,
  "combined_id": "5063_1_A_35",
  "analyst": "MR",
  "bottom_depth": 102,
  "continuity": null,
  "core_catcher": 1,
  "core_diameter": 47.5,
  "core_loss_reason": null,
  "core_ondeck": "2017-10-11 07:00:00",
  "core_recovery": 1.65,
  "core_recovery_pc": 110,
  "core_type": "R",
  "drilled_length": 1.5,
  "igsn": "ICDP5063ECQ8001",
  "last_section": 2,
  "mcd_offset": 0.8,
  "oriented": 0,
  "remarks": null,
  "temperature": null,
  "top_depth": 100.5,
  "site_id": 41,
  "expedition_id": 1,
  "program_id": 1,
  "archive_files": {
    "filter": {
      "expedition": 1,
      "site": 41,
      "hole": 205,
      "core": 314
    },
    "files": []
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

Error Response

Condition : Example. If 'core_catcher' is a string:

{
  "core_catcher": "CC" // should be 0 or 1
}
1
2
3

Code : 422 Unprocessable entity

Content :

[
  {
    "field": "core_catcher",
    "message": "CC must be an integer."
  }
]
1
2
3
4
5
6