/
account_activate ()

account_activate ()

Function prototype

account_activate (account, code, lang )

API Version

2.6.12 and higher

Supported interfaces

SOAP, REST

Description

Activates an account created with account_create().

If the activation is completed successfully, then a new session is created automatically and returned in the reponse (thus it is not necessary to perform a session_init() )

Post Sign-In actions

Since API version 2.7.28, when a patient signs-in for the first time, the system will enroll him in a default PROGRAM if the platform is configured to do so. See the $GLOBALS['CASE_DEFAULT_TEAM'] configuration parameter in WEB SERVICES CONFIGURATION form more detais about the configuration of the default PROGRAM.

Input parameters:

  • shared_key: an encrypted string that contains information about the communication channel used to create the account (email, phone...). This shared_key can be obtained from:

    • account_create(): returns the shared key after creating a new account that needs to be activated, and also after trying to create an account that already exists but needs to be activated.

    • session_init(): returns the shared key if the account exists but needs to be activated

    • An invitation sent by a other user in the system. In this scenario the shared key is sent by email/sms embedded in an URL that redirects to LC2 interface (to the "activate account" page)

  • code: value of the code that was sent by mail, sms... to activate the account

  • language: language code ('EN', 'ES', ...). If no language is provided, 'EN' will be used as default. This language will be used for the error description (if any)

Output parameters:

  • result: Additional information about the activation process:

    • session: This node is only included when no error happens. In this situation, a new session is created that can be used by the client (so that it is not necessary to do a session_init ())

    • account: Introduced in AP Version 2.7.20. If an error happens when trying to activate an account, the function will return an error code, and the node <account> will contain information about the account:

      • account: email or phone number used to do the activation

      • type: type of contact channel (email / phone)

  • ErrorMsg: In case of error, the description of the error in the language provided in the lang parameter

  • ErrorCode: In case of error, one of the possible ERROR CODES

Request example

account_activate(“34345jnf2nu3fwn”, "879q67", "ES");

Response

The response format is XML when the function has been invoked via the SOAP API, and JSON when it has been invoked via the REST API

Example in case of successful activation:

Example in case of account already active:

Return Error codes

ERROR CODE

 

ERROR CODE

 

ACCOUNT.INVALID_CODE

The code provided is not valid. The causes can be:

  • The expiration date of the code has been reached

  • Too many attempts to try an invalid code

USER.ATTEMPTS_LEFT

The code provided does is not valid but there is still one or more chances to try again

NO_PERSON_FOUND

The indicated account was not found or it does not need verification



Related content