Skip to content

Promise-based NodeJS REST wrapper for Drupal 7 Services API

Notifications You must be signed in to change notification settings

nvdnkpr/drupal-services

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

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

Coffeescript example:

Service = require('drupal-services').Service

service = new Service(
	'/endpoint'                             # Your Drupal Services endpoint
	{ username: 'user', password: 'enter' } # Login credentials
	{                                       # http/https request object
		hostname: 'yourserver.com'
		port: 443
	}
)

service.connect()
	.then(
		(user) ->
			# resource method args: resource path, method, request data (JSON)
			return service.resource 'node/1', 'put', { title: 'updated!' }
	)
	.then(
		(response) ->
			console.log response.body
	)

About

Promise-based NodeJS REST wrapper for Drupal 7 Services API

Resources

Stars

Watchers

Forks

Packages

No packages published