Class: Remote

Remote()

new Remote()

Represents a Remote instance
Do not call constructor directly.
Source:
See:

Methods

delete(spec, callback)

Send a delete request
Parameters:
Name Type Description
spec Object request spec
callback Object callback
Array attachments
Source:
Example
api.remote (request).delete ({
	  	endpoint: 'https://myserver.com/123456789'
	  }, {
	  	onStatus: function (status, chunked, headers) {
	  		api.logger.info (status + ': chunked: ' + chunked + ' > ' + headers);
	  	},
	  	onDone: function (status, data) {
	  		api.logger.info (status + ': data);
	  	},
	  	onError: function (status, message) {
	  		api.logger.error (status + ': ' + message);
	  	}
	  });

get(spec, callback)

Send a get request
Parameters:
Name Type Description
spec Object request spec
callback Object callback
Source:
Example
api.remote (request).get ({
	  	endpoint: 'https://myserver.com',
	  	data: {
	  		email: 'john@bluenimble.com'
	  	}
	  }, {
	  	onStatus: function (status, chunked, headers) {
	  		api.logger.info (status + ': chunked: ' + chunked + ' > ' + headers);
	  	},
	  	onDone: function (status, data) {
	  		api.logger.info (status + ': data);
	  	},
	  	onError: function (status, message) {
	  		api.logger.error (status + ': ' + message);
	  	}
	  });
Send a head request
Parameters:
Name Type Description
spec Object request spec
callback Object callback
Array attachments
Source:
Example
api.remote (request).head ({
	  	endpoint: 'https://myserver.com/123456789'
	  }, {
	  	onStatus: function (status, chunked, headers) {
	  		api.logger.info (status + ': chunked: ' + chunked + ' > ' + headers);
	  	},
	  	onDone: function (status, data) {
	  		api.logger.info (status + ': data);
	  	},
	  	onError: function (status, message) {
	  		api.logger.error (status + ': ' + message);
	  	}
	  });

patch(spec, callback)

Send a patch request
Parameters:
Name Type Description
spec Object request spec
callback Object callback
Array attachments
Source:
Example
api.remote (request).patch ({
	  	endpoint: 'https://myserver.com/123456789'
	  }, {
	  	onStatus: function (status, chunked, headers) {
	  		api.logger.info (status + ': chunked: ' + chunked + ' > ' + headers);
	  	},
	  	onDone: function (status, data) {
	  		api.logger.info (status + ': data);
	  	},
	  	onError: function (status, message) {
	  		api.logger.error (status + ': ' + message);
	  	}
	  });

post(spec, callback, attachments)

Send a post request
Parameters:
Name Type Description
spec Object request spec
callback Object callback
attachments Array attachments
Source:
Example
api.remote (request).post ({
	  	endpoint: 'https://myserver.com',
	  	data: {
	  		name: 'John', 
	  		age: 30, 
	  		address: '100 Rockefeller Dr, Sunnyvale CA'
	  	},
	  	headers: {
	  		'Content-Type': 'application/json'
	  	}
	  }, {
	  	onStatus: function (status, chunked, headers) {
	  		api.logger.info (status + ': chunked: ' + chunked + ' > ' + headers);
	  	},
	  	onDone: function (status, data) {
	  		api.logger.info (status + ': data);
	  	},
	  	onError: function (status, message) {
	  		api.logger.error (status + ': ' + message);
	  	}
	  });

put(spec, callback, attachments)

Send a put request
Parameters:
Name Type Description
spec Object request spec
callback Object callback
attachments Array attachments
Source:
Example
api.remote (request).put ({
	  	endpoint: 'https://myserver.com/123456789',
	  	data: {
	  		address: '200 Sheraton Dr, Sunnyvale CA'
	  	},
	  	headers: {
	  		'Content-Type': 'application/json'
	  	}
	  }, {
	  	onStatus: function (status, chunked, headers) {
	  		api.logger.info (status + ': chunked: ' + chunked + ' > ' + headers);
	  	},
	  	onDone: function (status, data) {
	  		api.logger.info (status + ': data);
	  	},
	  	onError: function (status, message) {
	  		api.logger.error (status + ': ' + message);
	  	}
	  });