/
associate_validate ()

associate_validate ()

Function prototype

associate_validate ( session, associate, mode)

API Version2.7.23 and higher

Validate all the data of the case before create or update.If mode = new and there is already existent case in database function will return it's id.

Input

parameters:

  • session: is the token obtained in the session_init call
  • associate: is n associate XML with the same structure that the one returned by associate_get_contact ()
  • mode: ("new" or "edit") Indicates if the data to validate is for creating a new ASSOCIATE or editing an existing one.

Output

parameters:

  • result: Structured information about the result of the validation.
  • ErrorMsg: if there is some problem with passed identifiers or channels (they are repeated in various patients or introduced identifier is different) will be returned error message.
  • ErrorCode: If any error occurs, then this value contains any of the standard ERROR CODES

Request

sample:

associate_validate ( “LCAAAAAAAAA”,

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<contact>
  <ref>14693</ref> <!-- This ref may not exist for a new CASE -->
  <data>
     <bdate>AAAAMMDD</bdate>
     <gender>M|F</gender>
     <nationality_ref>ES</nationality_ref>
  </data>
  <name>
    <given_name />
    <family_name />
  </name>
  <addresses>
    <address>
      <kind>Main Address</kind>
      <address />
      <district />
      <city />
      <postcode />
      <state />
      <country />
      <comment />
    </address>
  </addresses>
</contact>

“, 'new');

Response

sample:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<result>
  <case_validate>
    <validation>
      <errors>
        <field>
          <id>CONTACT.BDATE</id>
          <name>Birthdate</name>
          <error>CONTACT_FIELD.CANT_BE_NULL</error>
          <description>Can't be null</description>
        </field>
      </errors>
      <conflicts>
        <conflict>
          <name>Mary Doe</name>
          <gender>Female</gender>
          <birthdate>1968-03-12</birthdate>
          <age>52</age>
          <fields>
            <field>
              <id>CHANNEL.EMAIL</id>
              <name>e-mail</name>
              <value>marydoe@linkcare.es</value>
            </field>
          </fields>
        </conflict>
      </conflicts>
     </validation>
  </case_validate>
</result>
<ErrorMsg></ErrorMsg>

Please provide examples of the different actions that can be returned

Return Error codes

ERROR CODE

INVALID_TOKEN

The session token provided is not valid

INSUFFICIENT_PRIVILEGES

The session user does not have the necessary privileges to execute this action

CASE.NOT_FOUND

The CASE reference provided in XML data does not correspond to an existing USER

TEAM.NOT_FOUND

The TEAM reference provided does not correspond to a valid TEAM

PROGRAM.NOT_FOUNDThe PROGRAM reference provided does not correspond to a valid PROGRAM
CONTACT_DATA.VALIDATIONThe information provided to validate the CASE is not valid


Related content