{"id":21536031,"url":"https://github.com/twistedstack/titanium-drupal-adapter","last_synced_at":"2025-07-14T09:36:15.259Z","repository":{"id":200289897,"uuid":"705187883","full_name":"twistedstack/titanium-drupal-adapter","owner":"twistedstack","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-15T10:42:52.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-17T20:26:24.983Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/twistedstack.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,"governance":null}},"created_at":"2023-10-15T09:51:19.000Z","updated_at":"2023-10-15T10:42:55.000Z","dependencies_parsed_at":"2023-10-16T12:59:38.705Z","dependency_job_id":null,"html_url":"https://github.com/twistedstack/titanium-drupal-adapter","commit_stats":null,"previous_names":["twistedstack/titanium-drupal-adapter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/twistedstack/titanium-drupal-adapter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twistedstack%2Ftitanium-drupal-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twistedstack%2Ftitanium-drupal-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twistedstack%2Ftitanium-drupal-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twistedstack%2Ftitanium-drupal-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twistedstack","download_url":"https://codeload.github.com/twistedstack/titanium-drupal-adapter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twistedstack%2Ftitanium-drupal-adapter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265269848,"owners_count":23737928,"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-11-24T03:17:36.138Z","updated_at":"2025-07-14T09:36:15.068Z","avatar_url":"https://github.com/twistedstack.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cem style=\"color:red;\"\u003ePLEASE NOTE: This module has been replaced by a more general Javascript Drupal client:\u003cbr\u003ehttps://github.com/jbeuckm/drupal-client\u003c/em\u003e\n\n[![deprecated](http://badges.github.io/stability-badges/dist/deprecated.svg)](http://github.com/badges/stability-badges)\n\n# Requirements\n\n1. An installation of Drupal 7.x\n2. Services Module 3.4+ (implements the CSRF token for updated REST security)\n3. REST Server module enabled\n4. A Titanium project - probably works with most versions since this only uses Ti.Network.HTTPClient\n\n\n# Usage\n\nCreate a Service and enable (at least) the Resources called \"system\" and \"user\". Rename `config.js.example` to `config.js` and enter the url of your Drupal install and your service endpoint.\n\n### Get a session\n\n```javascript\n\nvar drupal = require('drupal');\n\ndrupal.systemConnect(\n\t//success\n\tfunction(sessionData) {\n\t\tvar uid = sessionData.user.uid;\n\t\tTi.API.info('session found for user '+uid);\n\t},\n\t//failure\n\tfunction(error) {\n\t\tTi.API.error('boo :(');\n\t}\n);\n```\n\n### Create an account\n\n```javascript \nvar user = {\n\tname: 'my_new_username',\n\tpass: 'my_new_password',\n\tmail: 'my_email@titaniumdrupal.com'\n};\n\ndrupal.createAccount(user,\n\t//success\n\tfunction(userData) {\n\t\tTi.API.info('yay!');\n\t},\n\t//failure\n\tfunction(error) {\n\t\tTi.API.error('boo :(');\n\t},\n\theaders //optional\n);\t\n```\n\n### Login\n\n```javascript\n\nvar my_username = \"\u003cDRUPAL USERNAME\u003e\";\nvar my_password = \"\u003cDRUPAL PASSWORD\u003e\";\n\nvar userObject;\n\ndrupal.login(my_username, my_password,\n\tfunction(userData) {\n\t\tTi.API.info('User ' + userData.uid + ' has logged in.');\n\t\tuserObject = userData;\n\t},\n\tfunction(err){\n\t\tTi.API.error('login failed.');\n\t}\n);\n```\n\n### Modify User Info\n\nThis updates an account profile on the server. `userObject` is a user object that may have been received from a login request (see above).\n\n```javascript\ndrupal.putResource(\"user/\"+userObject.uid, userObject, \n\tfunction(userData) {\n\t\tTi.API.info('user has been updated.');\n\t},\n\tfunction(err){\n\t\tTi.API.error('user update failed.');\n\t}\n);\n\t\n```\n### Make Requests\n\nThe workhorse function of the interface is `makeAuthenticatedRequest(config, success, failure, headers)`. There are a few helper functions included for posting/getting nodes, getting views, uploading files, etc. But they typically all construct a call to `makeAuthenticatedRequest`. This function should facilitate most things that people want to do with Drupal in a mobile environment. It's also easy to use `makeAuthenticatedRequest' to make requests agaist custom Services.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwistedstack%2Ftitanium-drupal-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwistedstack%2Ftitanium-drupal-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwistedstack%2Ftitanium-drupal-adapter/lists"}