/
case_insert_associate()

case_insert_associate()

Function prototype

case_insert_associate(session, case, associate )

API Version

All

The format of the response changed in version 2.7.12. See Response format prior to version 2.7.12 for additional information

Adds a new ASSOCIATE to a CASE.This operation is restricted by privileges granted to the session's user. The operation is only allowed when:

  • The CASE corresponds to the same session's user
  • The session's user is an ASSOCIATE of case and has the permission #PERMISSION.ASSOCIATE_MANAGE
  • The session's user is a PROFESSIONAL

After the successful execution of case_insert_associate(), a communication is sent (via eMail, phone or any other communication channel indicated in the associate parameter) to the ASSOCIATE. The communication includes a URL that contains a SHARED KEY OBJECT that will be used after the ASSOCIATE signs up or logs in the system to accept the invitation.

Input

parameters:

  • session: is the token obtained in the session_init call
  • case: The CASE to which the new associate will be added
  • associate: a XML with new associate data (see below). At least one IDENTIFIER or CHANNEL for the associate is always expected, and if not provided, an error will occur. The IDENTIFIERS and CHANNELS provided will be used to look for already existing CONTACTS with that data.
    • If there exist an CONTACT (and only one) with the indicated IDENTIFIERS or CHANNELS, then all provided data will be ignored and the existing CONTACT will be inserted as ASSOCIATE. Otherwise, a new ASSOCIATE will be created with the provided data.
    • If there exist more than one CONTACT with the indicated IDENTIFIERS or CHANNELS, then the list of possible CONTACTS will be returned so that it is possible to choose from one of the list
    • If no CONTACT exists, then a new one will be created

When an ASSOCIATE is inserted then it must also be accepted by the new associate. This will trigger a communication to the ASSOCIATE so that he can accept or reject the request. The communication includes a URL that contains a SHARED KEY OBJECT that will be used after the ASSOCIATE signs up or logs in the system to accept the invitation.

Output

parameters:

  • result: XML with information about the execution of the function:
    • ref: reference to the ASSOCIATE or empty if any error occurred
    • validation: This information is generated only if an error of type CONTACT_DATA.VALIDATION happens. See CONTACT DATA VALIDATION for a detailed explanation of the validation information
  • ErrorMsg: any fault in the call, either in the validation of input parameters, errors in the connection to the database or any other error, this parameter returns the error message produced
  • ErrorCode: If any error occurs, then this value contains any of the standard ERROR CODES

Request

sample:

case_insert_associate ( “LCAAAAAAAAA”, 2132, "

<associate>
   <ref/>     <!-- optional value. Only if the ASSOCIATE is known. if provided, the rest of fields are ignored -->
   <relationship>
      <type>
         <code>FAMILY</code>
      </type>
      <relative>
         <code>PARENT(M)</code>
      </relative>
   <relationship>
   <identifiers>
      <identifier>
         <label>NAT_ES</label>
         <value>46114346J</value>
      </identifier>
   </identifiers>
   <data>
      <bdate />
      <age />
      <gender />
   </data>
   <name>
      <given_name>Maria Rosa</given_name>
      <middle_name />
      <maiden_name />
      <family_name>Martinez</family_name>
      <family_name2 />
   </name>
   <channels>
      <phones>
         <phone>
            <type>mobile</type>
            <value>634546365</value>
         </phone>
      </phones>
      <emails>
         <email>
            <type>work</type>
            <value>mrmartinez@linkcare.es</value>
         </email>
      </emails>
   </channels>
   <permissions>
      <permission>
         <code>MEDICAL_PROFILE</code>
         <access_type>none</access_type>
      </permission>
      <permission>
         <code>ASSOCIATE</code>
         <access_type>edit</access_type>
      </permission>
   </permissions>
</associate>

")

Response

sample:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<result>
  <case_insert_associate>
    <ref>1234</ref>
    <validation></validation>
  </case_insert>
</result>
<ErrorMsg></ErrorMsg>
<ErrorCode></ErrorCode>

Return Error codes

ERROR CODE

INVALID_TOKEN

The session token provided is not valid

XML_ERROR

The information provided for creating the CASE does not have a valid XML format

INSUFFICIENT_PRIVILEGES

The session user does not have the necessary privileges to create an ADMISSION in the SUBSCRIPTION or the TEAM reference provided is not a member of the SUBSCRIPTION
CONTACT_DATA.VALIDATIONThe information provided to validate the CASE is not valid

Response format in version prior to version 2.7.12

The XML response generated in previous versions was the following

  • result: reference to the new CASE created or empty if any error occurred
  • type: ("NEW" / "EXIST") If the operation was successful, indicates whether a new CASE was created or a existing one that matched the information was used
  • ErrorMsg: any fault in the call, either in the validation of input parameters, errors in the connection to the database or any other error, this parameter returns the error message produced
  • ErrorCode: If any error occurs, then this value contains any of the standard ERROR CODES
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<result>case_id</result>
<type>NEW</type>
<ErrorMsg></ErrorMsg>

Related content