Oms API PATCH update run parameter value notes - openmpp/openmpp.github.io GitHub Wiki

Update parameter(s) value notes in model run.

This method merge (insert new or update existing) parameter(s) value notes in model run. Input data are json-encoded array of parameters, similat to the Param array part of JSON return from GET model run including text in all languages method.

Model can be identified by digest or by model name. It is recommended to use digest because it is uniquely identifies model.

Model run can be identified by run digest, run stamp or run name. It is recommended to use digest because it is uniquely identifies model run.

Each input element of parameters value notes array must have parameter Name and can have optional Txt array with LangCode and Note properties for each element. For example:

[
  {
    "Name": "ageSex",
    "Txt": [
      {
        "LangCode": "EN",
        "Note": "Age by Sex Default values"
      },
      {
        "LangCode": "FR",
        "Note": "Valeurs par défaut de l'âge par sexe"
      }
    ]
  },
  {
    "Name": "salaryAge",
    "Txt": [
      {
        "LangCode": "EN",
        "Note": "Salary by Age default values"
      },
      {
        "LangCode": "FR",
        "Note": "Salaire par âge valeurs par défaut"
      }
    ]
  }
]

LangCode must be one of model alguage codes or dialect of such, for example, it can be fr-CA or fr-FR if model has FR language. Note value can be empty.

If parameter value notes already exist for such parameter Name and LngCode then it will be replaced with new Note value. If there is no such parameter note then new value will be inserted.

This is a beta version and may change in the future.

Method:

PATCH /api/model/:model/run/:run/parameter-text

Arguments:

:model - (required) model digest or model name

Model can be identified by digest or by model name. It is recommended to use digest because it is uniquely identifies model. It is possible to use model name, which is more human readable than digest, but if there are multiple models with same name in database than result is undefined.

:run - (required) model run digest, run stamp or run name

Model run can be identified by run digest, run stamp or run name. It is recommended to use digest because it is uniquely identifies model run. Run stamp, if not explicitly specified as model run option, automatically generated as timestamp string, ex.: 2016_08_17_21_07_55_123. It is also possible to use name, which is more human readable than digest, but if there are multiple runs with same name in database than result is undefined.

JSON arguments:

It is expected to be same JSON as return of GET model run including text in all languages method.

For example (test.json file):

[{
    "Name": "ageSex",
    "Txt": [{
        "LangCode": "EN",
        "Note": "new value notes Age by Sex"
      }, {
        "LangCode": "FR",
        "Note": "nouvelles notes de valeur Âge par sexe"
      }
    ]
  }, {
    "Name": "StartingSeed",
    "Txt": [{
        "LangCode": "EN",
        "Note": "new value notes Starting seed"
      }
    ]
  }, {
    "Name": "baseSalary",
    "Txt": [{
        "LangCode": "EN",
        "Note": "new value notes Base Salary"
      }
    ]
  }
]

Call examples:

curl -v -X PATCH -H "Content-Type: application/json" http://localhost:4040/api/model/modelOne/run/Default-4/parameter-text -d @test.json
curl -v -X PATCH -H "Content-Type: application/json" http://localhost:4040/api/model/_201208171604590148_/run/3356660729aaaaccf04f1699248c4355/parameter-text -d @test.json

Output example:

* Connected to localhost (::1) port 4040 (#0)
> PATCH /api/model/_201208171604590148_/run/3356660729aaaaccf04f1699248c4355/parameter-text HTTP/1.1
> Host: localhost:4040
> User-Agent: curl/7.55.1
> Accept: */*
> Content-Type: application/json
> Content-Length: 469
>
* upload completely sent off: 469 out of 469 bytes
< HTTP/1.1 200 OK
< Content-Location: /api/model/_201208171604590148_/run/3356660729aaaaccf04f1699248c4355/parameter-text
< Content-Type: text/plain
< Date: Tue, 26 Oct 2021 02:48:34 GMT
< Content-Length: 0
<
* Connection #0 to host localhost left intact
⚠️ **GitHub.com Fallback** ⚠️