Skip to content

Latest commit

 

History

History
103 lines (75 loc) · 3.07 KB

File metadata and controls

103 lines (75 loc) · 3.07 KB

#API Object: OWF.Preferences.doesUserPreferenceExist (cfg)#

#####Definition: Use the /doesUserPreferenceExist API to query if they system includes a specific user preference. It will search based on preferences' namespaces and names.

#####How it works:##### A system makes a call to another system that asks to reference data instead of return it. To make this call, one of the following REST Calls will request user data from the user profile URI [IS THIS RIGHT?]

#####Request URL:#####

https://localhost:8443/owf/prefs/hasPreference/com.company.widget/First%20President?version=7.15.0-v1&dojo.preventCache=1433169029635

#####Request Method:##### GET, Form_Method:none

#####Requirements:##### The call must include namespace and name

  • If namespace or name are null, it will change the null to 'undefined' and search for a namespace and/or name that is called 'undefined'.
  • If name or namespace use an empty string that is not null, the query returns the HTML 404 error "The requested resource is not available."

#####Response:#####

If there is a preference matching the namespace and name it will return:

{"preferenceExist":true,"statusCode":200}

If there is not a matching preference it will return:

{"preferenceExist":false,"statusCode":200}

#####How to use it:##### Use it to find user preferences.


###Example###

The following is an example of a call to delete user preference:

function onSuccess(pref) {alert(pref.value);}
function onFailure(error,status) {
    alert('Error ' + error);
    alert(status);
}
var cfg = {
    namespace: 'com.company.widget',
    name: 'First President',
    onSuccess: onSuccess,
    onFailure: onFailure
};

OWF.Preferences.doesUserPreferenceExist(cfg);

###Resource Information###

Parameter Description
{Object} cfg Use the following properties to configure the object. EXAMPLE???
{String} cfg.namespace The namespace of the user preference.
{String} cfg.name The name of the user preference.
{Function} cfg.onSuccess The function that will be called if the user preference is successfully deleted from the database.
{Function} cfg.onFailure Optional The system returns this function if the user preference cannot be deleted from the database or if the preference does not exist. If this function is not specified a default error message display.
This function passes back the following parameters:
error: String
Status: The HTTP Status code

###Possible Errors###

Error Action
HTTP Status 404: “The requested resource is not available” Enter a preference name and namespace.