rbf_removeSessionData()

Purpose

This function removes the user session data for the specified key.

If this function raises an error, Platform sets the HTTP status to 500 and invokes the callback function provided via rbf_setErrorsCallback() and passes that function one of the following messages:

  • Empty key received! — No key parameter was passed
  • No Mappings Set for [key] — There is no value associated with the specified key

Note: If this function call results in an error, and you have not configured a callback function using rbf_setErrorsCallback(), you will still see the HTTP status of 500 but will not see the reason for the error.

Syntax

rbf_removeSessionData(key, callback);

Parameters

key

A string that is the key for a key/value pair of stored custom session data

callback

A function that takes a single data value. This parameter is optional; if it is not passed, the HTTP status will appear in the console but no return value is passed.

Note: This API is not supported in portals.

Return value

If successful, sets the HTTP status to 200 and passes the string OK to callback as the first argument

Example

The following example removes the custom user session data associated with the key "name1":

<script>
  var callback = function(errMsg, apiName) {
      alert("ERROR: "+errMsg+" in: "+apiName);
      };
      rbf_setErrorsCallback(callback);
  var handleSessionData = function (returnValue) {
    if(console){
      console.log("**** Processing handleSessionData ****");
      console.log("Response is " +returnValue);
    }
  }
  rbf_removeSessionData("name1", handleSessionData);
  </script>