SystemResource
d7-services.resources.system
This service mirrors the Drupal system resource of the services 3.x module. To use this you have to set following line in your Drupal CORS module settings
Returns the details of currently logged in user.
Method: POST Url: http://drupal_instance/api_endpoint/system/connect
| Promise | Object with session id, session name and a user object. |
performing a system connect request and handling data in promise callback
angular
.module('myModule', ['d7-services.resources.system'])
.config(function (SystemResource) {
SystemResource.connect()
.then(
function(confirmData) {...},
function(failData) {...}
);
}
performing a system connect request and handling data in event callback
angular
.module('myModule', ['d7-services.resources.system'])
.config(function ($scope, SystemResource, SystemChannel) {
SystemResource.connect();
//subscribe to confirm event
SystemChannel.subConnectConfirmed($scope, function(confirmData) {...});
//subscribe to fail event
SystemChannel.subConnectFailed($scope, function(failData) {...});
});
Unsets a persistent variable. Case-sensitivity of the variable_* functions depends on the database collation used. To avoid problems, always use lower case for persistent variable names.
Method: POST Url: http://drupal_instance/api_endpoint/system/del_variable
| Param | Type | Details |
|---|---|---|
| data | Object |
|
| data.name | String |
|
| Promise | True if successful false if not |
performing a system del_variable request and handling data in promise callback
angular
.module('myModule', ['d7-services.resources.system'])
.config(function (SystemResource) {
SystemResource.del_variable({})
.then(
function(confirmData) {...},
function(failData) {...}
);
}
performing a system del_variable request and handling data in event callback
angular
.module('myModule', ['d7-services.resources.system'])
.config(function ($scope, SystemResource, SystemChannel) {
SystemResource.del_variable({});
//subscribe to confirm event
SystemChannel.subDelVariableConfirmed($scope, function(confirmData) {...});
//subscribe to fail event
SystemChannel.subDelVariableFailed($scope, function(failData) {...});
});
Returns a persistent variable. Case-sensitivity of the variable_* functions depends on the database collation used. To avoid problems, always use lower case for persistent variable names.
Method: POST Url: http://drupal_instance/api_endpoint/system/get_variable
| Param | Type | Details |
|---|---|---|
| data | Object |
|
| data.name | String |
|
| data._default | String |
|
| Promise | Object with session id, session name and a user object. |
performing a system get_variable request and handling data in promise callback
angular
.module('myModule', ['d7-services.resources.system'])
.config(function (SystemResource) {
SystemResource.get_variable()
.then(
function(confirmData) {...},
function(failData) {...}
);
}
performing a system get_variable request and handling data in event callback
angular
.module('myModule', ['d7-services.resources.system'])
.config(function ($scope, SystemResource, SystemChannel) {
SystemResource.get_variable();
//subscribe to confirm event
SystemChannel.subGetVariableConfirmed($scope, function(confirmData) {...});
//subscribe to fail event
SystemChannel.subGetVariableFailed($scope, function(failData) {...});
});
Sets a persistent variable. Case-sensitivity of the variable_* functions depends on the database collation used. To avoid problems, always use lower case for persistent variable names.
The data object for this request looks something like this: { name : 'my_variable_name' }
Method: POST Url: http://drupal_instance/api_endpoint/system/set_variable
| Param | Type | Details |
|---|---|---|
| data | Object |
|
| data.name | String |
|
| data.value | String |
|
| Promise | True if successful false if not |
performing a system set_variable request and handling data in promise callback
angular
.module('myModule', ['d7-services.resources.system'])
.config(function (SystemResource) {
SystemResource.set_variable()
.then(
function(confirmData) {...},
function(failData) {...}
);
}
performing a system set_variable request and handling data in event callback
angular
.module('myModule', ['d7-services.resources.system'])
.config(function ($scope, SystemResource, SystemChannel) {
SystemResource.set_variable({});
//subscribe to confirm event
SystemChannel.subSetVariableConfirmed($scope, function(confirmData) {...});
//subscribe to fail event
SystemChannel.subSetVariableFailed($scope, function(failData) {...});
});