{"id":17056404,"url":"https://github.com/biophoton/ng-drupal-7-services","last_synced_at":"2025-08-11T15:13:11.546Z","repository":{"id":29216402,"uuid":"32748010","full_name":"BioPhoton/ng-drupal-7-services","owner":"BioPhoton","description":"Well structured AngularJS modules mimic the architecture of Drupal Services 3.x. for your next AngularJS / Ionic Drupal Headless / Decoupled project","archived":false,"fork":false,"pushed_at":"2016-08-15T16:42:36.000Z","size":7902,"stargazers_count":26,"open_issues_count":2,"forks_count":10,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-04-14T02:19:32.989Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://drupalionic.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BioPhoton.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-23T17:33:59.000Z","updated_at":"2023-02-14T13:40:35.000Z","dependencies_parsed_at":"2022-09-11T06:50:18.521Z","dependency_job_id":null,"html_url":"https://github.com/BioPhoton/ng-drupal-7-services","commit_stats":null,"previous_names":["biophoton/ng-drupal-ionic"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BioPhoton%2Fng-drupal-7-services","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BioPhoton%2Fng-drupal-7-services/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BioPhoton%2Fng-drupal-7-services/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BioPhoton%2Fng-drupal-7-services/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BioPhoton","download_url":"https://codeload.github.com/BioPhoton/ng-drupal-7-services/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248603608,"owners_count":21131830,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T10:24:21.280Z","updated_at":"2025-04-12T17:26:18.750Z","avatar_url":"https://github.com/BioPhoton.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Angular/Ionic Drupal7 Services\n#### Well structured angular modules mimic the architecture of [Drupal Services 3.x](https://www.drupal.org/project/services)\n\n[![Bower version](https://badge.fury.io/bo/ng-drupal-7-services.svg)](https://badge.fury.io/bo/ng-drupal-7-services)\n[![npm version](https://badge.fury.io/js/ng-drupal-7-services.svg)](https://badge.fury.io/js/ng-drupal-7-services)  \n[![Package Quality](http://npm.packagequality.com/shield/ng-drupal-7-services.svg)](http://packagequality.com/#?package=ng-drupal-7-services)\n\nAngular Drupal7 Services is a REST client for AngularJS, which allows you to user predefined functions when communication with Drupal's api endpoints.   \nUnlike the other project focusing on the same topic, Angular Drupal7 Services is precisely organized around the [Drupal Services 3.x](https://www.drupal.org/project/services) architecture and naming conventions.   \n  \nIt optionally provides events next to the common used promise approach.\n\nA full set of Drupal's resources is available, and all basic workflow's depending to authentication or helpers for CRUD operations are also provided as a set of extra modules.\n\n##DEMOS\nCheck out the [Drupal-API-Explorer](https://github.com/BioPhoton/ng-drupal-services-tests-with-ng) for a full demo  \nOr check out the sample implementation for [Ionic-Headless-Drupal](https://github.com/BioPhoton/Ionic-Angular-Headless-Drupal-Demo)\n\n\n## Get Started\n\n**(1)** Get Angular Drupal7 Services:\n - clone \u0026 build this repository\n - [download as .zip](https://github.com/BioPhoton/ng-drupal-7-services/archive/master.zip)\n - or via **[npm](https://www.npmjs.org/)**: by running `$ npm install ng-drupal-7-services` from your console\n - or via **[Bower](http://bower.io/)**: by running `$ bower install ng-drupal-7-services` from your console\n\n**(2)** Include `ng-drupal-7-services.js` in your `index.html`.\n\n**(3)** Add `'d7-services'` to your main module's list of dependencies\n\n\n## [API Documentation](http://www.drupalionic.org/docs) (!!!in progress!!!)\n\n## Quickstart\n\n**(1)** Insert the ```ng-drupal-7-services.js``` bundle into your ```index.html``` file.\n\n```html\n\u003c!doctype html\u003e\n\u003chtml ng-app=\"myApp\"\u003e\n\u003chead\u003e\n\n    \u003cscript src=\"bower_components/angular/angular.min.js\"\u003e\u003c/script\u003e\n    \u003c!-- ng-drupal-7-services and it's dependencies--\u003e\n    \u003cscript src=\"bower_components/angular-cookies/angular-cookies.min.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"bower_components/ngstorage/ngStorage.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"bower_components/ng-drupal-7-services/dist/ng-drupal-7-services.js\"\u003e\u003c/script\u003e\n\n    \u003cscript\u003e\n        angular.module('myApp', ['d7-services'])\n        .config(function configFunction(DrupalApiConstant) {\n                \t\t//configure your drupal instance\n                \t\tDrupalApiConstant.drupal_instance = 'http://your.projects.domain/';\n                \t});\n    \u003c/script\u003e\n    ...\n\u003c/head\u003e\n\u003cbody\u003e\n    ...\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n**(2)** Using the services.\n\n```javascript\nangular\n    angular.module('myApp')\n    .controller('NodeController', ['NodeResource', 'NodeChannel', function(NodeResource, NodeChannel){\n\n        //fire request\n         var retrievePromis = NodeResource.retrieve({nid:1});\n\n        //using promise.then callbacks\n        retrievePromis.then(function(data) { ... },function(error) { ... });\n\n        //subscribing to events\n        //This could happen in another directive/controller too\n        NodeChannel.subRetrieveConfirmed($scope, function(data){ ... });\n        NodeChannel.subRetrieveFailed($scope, function(error){ ... });\n\n    }]);\n```\n\n##Configuration\nBasically all configurable options are wrapped in an angular constant.\nIF you changed any of Drupal's default settings adopt the constants in DrupalApiConstant in Angular's config phase as shown above.\nFind all available options in the [API Documentation](http://www.drupalionic.org/docs) under Commons/DrupalApiConstant.\n```javascript\n  angular.module('myApp', ['d7-services'])\n        .config(function configFunction(DrupalApiConstant) {\n           ...\n           //your changes here\n           ...\n        });\n```\n\n##Supported Drupal Modules\nHere is a list of supported Drupal services 3.x modules:\n- [x] [Services](https://www.drupal.org/project/services) **7 Resources** | **51 Requests**\n- [x] [Services Views](https://www.drupal.org/project/services_view) **1 Resources** | **1 Requests**\n- [x] [Services Menu](https://www.drupal.org/project/services_menu) **1 Resources** | **1 Requests**\n- [ ] [Services Search](https://www.drupal.org/project/services_search) **2 Resources** | **2 Requests**\n- [ ] [Services Entity](https://www.drupal.org/project/services_entity) **6 Resources** | **47 Requests**\n- [x] [Services Definitions](https://www.drupal.org/project/services_tools) **1 Resources** | **1 Requests**\n- [x] [Geocoder](https://www.drupal.org/project/geocoder) **1 Resources** | **2 Requests**\n\n##Extra Resources\nFollowing extramodules are provided for simplifing authentication routing and viewcomposition \n- [x] Authentication **authenticaion workflows and helper functions**\n- [x] AccessControl **handle access for routing and actions**\n- [x] Directives **show hide elements by role or accesslevel**\n\n\n- **Drupal Services**\n  - Comment Resource\n    - Retrieve\n    - Create\n    - Update\n    - Delete\n    - Index\n    - CountAll\n    - CountNew\n    - Retrieve\n  - File Resource\n    - Retrieve\n    - Create\n    - Delete\n    - Index\n    - Create_raw\n  - Node Resource\n    - Retrieve\n    - Create\n    - Update\n    - Delete\n    - Index\n    - Files\n    - Comments\n    - Attach_file\n  - System Resource\n    - Connect\n    - Get_variable\n    - Set_variable\n    - Del_variable\n  - TaxonomyTerm Resource\n    - Retrieve\n    - Create\n    - Update\n    - Delete\n    - Index\n    - SelectNodes  \n  - TaxonomyVocabulary Resource\n    - Retrieve\n    - Create\n    - Update\n    - Delete\n    - Index\n    - GetTree\n  - User Resource\n    - Retrieve\n    - Create\n    - Update\n    - Delete\n    - Index\n    - Login\n    - Logout\n    - Token \n    - Request_new_password\n    - Register\n    - Cancel\n    - Password_reset\n    - Resend_welcome_email\n\n- **Drupal Services Views**\n  - Views Resource\n    - Retrieve\n\n- **Drupal Geocoder**\n  -Views Geocoder\n    - Retrieve\n    - Index\n\n- **Drupal Services Menu**\n  - Menu Resource\n    - Retrieve\n\n- **Drupal Services Definition**\n  - Definition Resource\n    - Index\n\n- **Extra Resources**\n  - Authentication service\n    - storeTokenData\n    - deleteTokenData\n    - refreshToken\n    - storeSessionData\n    - deleteSessionData\n    - getConnectionState\n    - setConnectionState\n    - getCurrentUser\n    - setCurrentUser\n    - refreshConnection\n    - getLastConnectTime\n\n# Extra Services\n##AccessControl\n- roles\n- accessLevels \n- authorize \n\n### Directives\n- accessLevel =\u003e show hide elem based on role and acessLevel\n\n## Setup for Drupal\n- Start with a fresh Drupal7 installation.\n\n###Services\n- install [Drupal Services](https://www.drupal.org/project/services) \n- Go to  admin/structure/services/add and create a new endpoint with following settings:\n  - machine name: api\n  - server: REST\n  - path: api\n  - debug: unchecked\n  - session authentication: checked\n- Then click the edit resources link and open the resources tab.\n  Now every resource you like by check box. \n- Then click Save\n- Click the Server tab\n- For Response formatters check following:\n  - json\n- For Request parsing check following:\n  - application/json\n  - application/x-www-form-urlencoded\n  - multipart/form-data (for file upload)\n  - text/xml\n- Click Save. \n- Flush all of Drupal's caches.\n\n###Setup for CORS\n- install [CORS](https://www.drupal.org/project/cors) \n- Go to admin/config/services/cors  and paste following into the textarea   \n \n`api/v1*|\u003cmirror\u003e|POST,PUT,GET,DELETE|Content-Type,Authorization,X-CSRF-TOKEN|true`\n\n#Links\nTesting resources on a test server =\u003e https://www.drupal.org/node/1447020\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiophoton%2Fng-drupal-7-services","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiophoton%2Fng-drupal-7-services","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiophoton%2Fng-drupal-7-services/lists"}