Skip to content

The Variables resource

jeff-h edited this page Feb 14, 2016 · 2 revisions

This endpoint returns all the Drupal variables (from the variables database table). The client must be authenticated. The value for one variable can be retrieved by adding the variable name to the end of the URL e.g. http://mydrupalsite.com/api/v1.0/variables/admin_theme

SAMPLE REQUEST
// Get Drupal variables

jQuery.ajax({
    url: "http://mydrupalsite.com/api/v1.0/variables",
    type: "GET",
})
.done(function(data, textStatus, jqXHR) {
    console.log("HTTP Request Succeeded: " + jqXHR.status);
    console.log(data);
})
.fail(function(jqXHR, textStatus, errorThrown) {
    console.log("HTTP Request Failed");
})
.always(function() {
    /* ... */
});
SAMPLE RESPONSE

For the URL: http://mydrupalsite.com/en/api/v1.0/variables/admin_theme

{
  "data": [
    {
      "variable_name": "admin_theme",
      "variable_value": "seven"
    }
  ],
  "self": {
    "title": "Self",
    "href": "http://mydrupalsite.com/en/api/v1.0/variables/admin_theme"
  }
}
Clone this wiki locally