I'm new with loopback (I'm using 3.27 version). I'm trying to call an endpoint REST that gives me a json.
I created a Datasource:
{
"connector": "rest",
"debug": false,
"options": {
"headers": {
"accept": "application/json",
"content-type": "application/json"
},
"strictSSL": false
},
"operations": [
{
"template": {
"method": "GET",
"url": "http://foobar.com,
"options": {
"strictSSL": false,
"useQuerystring": false
},
"responsePath": "$.results"
},
"functions": {
“getFooBar: []
}
}
]
}
Then in a boot script, I would invoke the endpoint that I defined in the datasource (foobar) programmatically, because it has to be called from a crontab.
- How can I invoke the GET operation?
- I have to create a function in the boot script named getFooBar()?
- How can I get the JSON returned by the endpoint?
Thank you