Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.
/ drupal-services Public archive

Promise-based NodeJS REST wrapper for Drupal 7 Services API

Notifications You must be signed in to change notification settings

elrolito/drupal-services

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Drupal Services

A pretty simple promise-based wrapper for using the Drupal 7 Services 3.x API. Request and response uses JSON.

Handles session cookie, user token and x-csrf headers.

Usage

NOTE Major API changes in this version!!

Coffeescript example:

{Service} = require 'drupal-services'

endpoint =
	protocol: 'https'
	auth: 'user:password'
	hostname: 'apiserver.com'
	pathname: '/myendpoint'

service = new Service endpoint

# Query node resource
service
.index '/node'
.then (results) ->
	console.log results

# If user needs to be logged in, using factory method:
Service
.factory endpoint
.login 'user', 'password'
.then (user) ->
	# Retreive a node
	service.retreive 'node', 1

.then (node) ->
	console.log node

Todo

I still need to write some more tests :)

About

Promise-based NodeJS REST wrapper for Drupal 7 Services API

Resources

Stars

Watchers

Forks

Packages

No packages published