我创建了一个 API 端点,例如:
GET /etablissementDetails/{id}
这是我的datasources.json文件:
"etablissementDetailsREST": {
"name": "etablissementDetailsREST",
"crud": false,
"connector": "rest",
"debug": false,
"options": {
"headers": {
"accept": "application/json",
"content-type": "application/json"
},
"strictSSL": false
},
"operations": [
{
"template": {
"method": "GET",
"url": "https://data.education.gouv.fr/api/records/1.0/search/?dataset=fr-en-adresse-et-geolocalisation-etablissements-premier-et-second-degre",
"headers": {
"accepts": "application/json",
"content-type": "application/json"
},
"query": {
"q": "{id}"
},
"options": {
"strictSSL": true,
"useQuerystring": true
},
"responsePath": "$.records.*"
},
"functions": {
"{id}": ["id"]
}
}
]}
在环回资源管理器中,如果我作为一个想法输入并单击 Try me out (Run the GET),我会得到以下信息:
http://localhost:3000/api/v1/etablissementDetails/{id}?id=0593904Y
我希望直接在 URL中将{id}替换为0593904Y成为http://localhost:3000/api/v1/etablissementDetails/0593904Y