ma-https-services
v1.0.3
Published
ma-https-services is a package to be used by mobilearts to call apis and store their logs in S3 and ES.
Downloads
2
Readme
ma-https-services
ma-https-services is a package to be used by mobilearts to call apis and store their logs in S3 and ES.
Function
- callApi(data)
Installation
Install the dependencies.
cd yourpath
npm i ma-https-services
Usage
After installation add requirment to your code
const MA_Https = require('ma-https-services');
const httpsServices = new MA_Https();
Fields
required: hostname OR url
optional: pathname "" protocol (default "https") method (default "GET") params {} headers {} body "", {}
Example 1:
var data =
{
"url" : "https://wtv.com/path1",
"params": {"param1":1, "param2":2},
"headers": {"Content-type":"application/x-www-form-urlencoded"},
"method" : "POST"
}
httpsServices.callApi(data)
Example 2:
var data =
{
"hostname" : "wtv.com",
"protocol" : "http",
"pathname" : "path1",
"params": {"param1":1, "param2":2},
"headers": {"Content-type":"application/x-www-form-urlencoded"}
}
httpsServices.callApi(data)