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
question from:
https://stackoverflow.com/questions/65905247/rest-connector-with-loopback-3-x-loopback-connector-rest 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…