Skip to content

Commit f963b06

Browse files
committed
Update endpoint
1 parent 01638fb commit f963b06

4 files changed

Lines changed: 16 additions & 6 deletions

File tree

context-provider/controllers/proxy/static-api.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ function getAsNGSIv2(req, res) {
7979
// The /ngsi-ld/v1/entities/:id endpoint responds with data in the NGSI-LD format
8080
//
8181
function getAsNgsiLD(req, res, asArray = false) {
82+
83+
console.log(req.params)
8284
const response = Formatter.formatAsLDResponse(req, null, (name, type) => {
8385
return staticValues[type.toLowerCase()];
8486
});

context-provider/lib/formatter.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ function formatAsV2Response(req, inputData, attributeValueCallback) {
8888
// Formatting function for an NGSI v1 response to a context query.
8989
//
9090
function formatAsV1Response(req, inputData, attributeValueCallback) {
91+
console.log(req.params.mapping)
9192
const mappedAttributes = parseMapping(req.params.mapping);
9293

9394
const ngsiV1Response = {

context-provider/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"express": "~4.17.3",
3434
"express-session": "^1.17.2",
3535
"http-errors": "^2.0.0",
36-
"jsonld": "^5.2.0",
36+
"jsonld": "^8.3.3",
3737
"jsonwebtoken": "^8.5.1",
3838
"lodash": "^4.17.21",
3939
"moment": "^2.29.1",

context-provider/routes/proxy-ld.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,18 @@ function noOp(req, res) {
7070
}
7171

7272

73-
router.get('/catfacts/:type/:mapping/ngsi-ld/v1/entities', CatFactsNGSIProxy.getAsNgsiLD, true);
74-
router.get('/random/:type/:mapping/ngsi-ld/v1/entities', RandomNGSIProxy.getAsNgsiLD, true);
75-
router.get('/static/:type/:mapping/ngsi-ld/v1/entities', StaticNGSIProxy.getAsNgsiLD, true);
76-
router.get('/twitter/:type/:mapping/:queryString/ngsi-ld/v1/entities', TwitterNGSIProxy.getAsNgsiLD, true);
77-
router.get('/weather/:type/:mapping/:queryString/ngsi-ld/v1/entities', WeatherNGSIProxy.getAsNgsiLD, true);
73+
router.get('/catfacts/tweets/ngsi-ld/v1/entities', tweetDefaults, (req, res) => {
74+
req.params.id = req.query.ids || '12345'
75+
CatFactsNGSIProxy.getAsNgsiLD(req, res, true);
76+
});
77+
router.get('/random/tweets/ngsi-ld/v1/entities', tweetDefaults, (req, res) => {
78+
req.params.id = req.query.ids || '12345'
79+
RandomNGSIProxy.getAsNgsiLD(req, res, true);
80+
});
81+
router.get('/static/tweets/ngsi-ld/v1/entities', tweetDefaults, (req, res) => {
82+
req.params.id = req.query.ids || '12345'
83+
StaticNGSIProxy.getAsNgsiLD(req, res, true);
84+
});
7885

7986

8087

0 commit comments

Comments
 (0)