Show Table of Contents
Chapter 8. $fh.service
$fh.service(options, callback);
Call an endpoint in an MBaaS Service.
Minimum Requirements
- fh-mbaas-api : v4.9.1
8.1. Example
var $fh = require('fh-mbaas-api');
$fh.service({
"guid" : "0123456789abcdef01234567", // The 24 character unique id of the service
"path": "/hello", //the path part of the url excluding the hostname - this will be added automatically
"method": "POST", //all other HTTP methods are supported as well. for example, HEAD, DELETE, OPTIONS
"params": {
"hello": "world"
}, //data to send to the server - same format for GET or POST
"timeout": 25000, // timeout value specified in milliseconds. Default: 60000 (60s)
"headers" : {
// Custom headers to add to the request. These will be appended to the default headers.
}
}, function(err, body, res) {
console.log('statuscode: ', res && res.statusCode);
if ( err ) {
// An error occurred during the call to the service. log some debugging information
console.log('service call failed - err : ', err);
} else {
console.log('Got response from service - status body : ', res.statusCode, body);
}
});
Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.