CreateKeyValueData_v1 - Medaxion/open_api_resources GitHub Wiki

Create/Update Ops, Billing, Demographic Data

Notes: If a datum that matches the provided key already exists, it will be updated with the new value rather than a new datum being created. The no-touch attribute must be set on every datum provided in the array to prevent setting the updated_at on the subject (case or encounter). While previously created keys cannot be deleted, they can be updated with a NIL or other unrecognizable character.


## HTTP Request

  • Method: POST
  • Content-Type: application/json or application/xml

Ops Data URL Construction

Available for Cases and Encounters

POST => X:{schedule_token}@{base_url}/open_api/v1/cases/case_id/ops_data.[json|xml]
POST => X:{schedule_token}@{base_url}/open_api/v1/encounters/encounter_id/ops_data.[json|xml]

Billing Data URL Construction

Available for Cases and Encounters

POST => X:{schedule_token}@{base_url}/open_api/v1/cases/case_id/billing_data.[json|xml]
POST => X:{schedule_token}@{base_url}/open_api/v1/encounters/encounter_id/billing_data.[json|xml]

Demographic and Insurance URL Construction

Only Available for Cases

POST => X:{schedule_token}@{base_url}/open_api/v1/cases/case_id/demographic_and_insurance_data.[json|xml]

Request Parameters

Sample JSON Payload (all 3 data types)

{
  "ops_data": [
    {
      "key": "foo",
      "value": "bar",
      "hidden": true,
      "no_touch": false
    },
    {
      "key": "biz",
      "value": "baz",
      "hidden": true,
      "no_touch": false
    }
  ]
}
{
  "billing_data": [
    {
      "key": "foo",
      "value": "bar",
      "hidden": true,
      "no_touch": false
    },
    {
      "key": "biz",
      "value": "baz",
      "hidden": true,
      "no_touch": false
    }
  ]
}
{
  "demographic_and_insurance_data": [
    {
      "key": "foo",
      "value": "bar",
      "hidden": true,
      "no_touch": false
    },
    {
      "key": "biz",
      "value": "baz",
      "hidden": true,
      "no_touch": false
    }
  ]
}

Sample XML Payload (showing ops-data only)

<ops-data type="array">
  <ops-datum>
    <key>foo</key>
    <value>bar</value>
    <hidden type="boolean">true</hidden>
    <no-touch type="boolean">false</no-touch>
  </ops-datum>
  <ops-datum>
    <key>biz</key>
    <value>baz</value>
    <hidden type="boolean">true</hidden>
    <no-touch type="boolean">false</no-touch>
  </ops-datum>
</ops-data>

Response Status Codes / Messages

Response Code Response Message
201 (message as below)
401 Unauthorized
404 Case Not Found
422 (Unprocessable Entity)

Successful Create Response Examples

Sample XML response

<ops-data type="array">
  <ops-datum>
    <id type="integer">11863</id>
  </ops-datum>
  <ops-datum>
    <id type="integer">11864</id>
  </ops-datum>
</ops-data>

Sample JSON response

{
    "ops_data":
    [
        {
            "id": 11863
        },
        {
            "id": 11864
        }
    ]
}

(Unprocessable Entity) Examples

Sample XML response

<ops-data type="array">
  <ops-datum>
    <key>foo</key>
    <value nil="true" />
    <hidden type="boolean">true</hidden>
    <errors>
      <value type="array">
        <value>can't be blank</value>
      </value>
      <key type="array">
        <key>must be unique</key>
      </key>
    </errors>
  </ops-datum>
  <ops-datum>
    <key>foo</key>
    <value>bar</value>
    <hidden type="boolean">true</hidden>
    <errors>
      <key type="array">
        <key>must be unique</key>
      </key>
    </errors>
  </ops-datum>
</ops-data>

Sample JSON response

{
  "ops_data":
  [
    {
      "key": "foo",
      "value": null,
      "hidden": true,
      "errors":
      {
        "value":
        [
          "can't be blank"
        ],
        "key":
        [
          "must be unique"
        ]
      }
    },
    {
      "key": "foo",
      "value": "baz",
      "hidden": true,
      "errors":
      {
        "key":
        [
          "must be unique"
        ]
      }
    }
  ]
}
⚠️ **GitHub.com Fallback** ⚠️