HERE Maps REST API unable to load route Trace Points - here-api

I'm trying to load a route from trace points according to:
https://developer.here.com/documentation/routing-api/dev_guide/topics/route-import.html
and:
https://developer.here.com/documentation/routing-api/api-reference-swagger.html (under the trace points heading)
curl -X GET \
'https://router.hereapi.com/v8/import?apikey=abc123&transportMode=truck&return=polyline'
{
"trace": [
{
"lat": 52.541121,
"lng": 13.278989
},
{
"lat": 52.541338,
"lng": 13.276435
},
...
]
}
I get a 403 error back like this:
{"error":"Forbidden","error_description":"These credentials do not authorize access"}
If I change the apiKey to deliberately make it wrong I get a 401 error like this:
{"error":"Unauthorized","error_description":"apiKey invalid. apiKey not found."}
So I know the key is correct.
How can I get access to be able to load a route from trace points?
I'm using about 1850 points on the route.

Related

Can't create stack from template using Openstack Heat API

I'm trying to create a stack from a template using the Heat API. I'm using the API reference here as a guide. I have the following json in a file called single-server-template.json:
{
"stack_name": "api-test",
"template": {
"heat_template_version": "rocky",
"description": "Testing Heat API\n",
"resources": {
"server1": {
"type": "OS::Nova::Server",
"properties": {
"name": "Server1",
"image": "Ubuntu 22.04 (Jammy)",
"flavor": "alt.st1.small",
"key_name": "my_key",
"networks": "Internal"
}
}
}
}
}
I'm sending it with this: curl -X POST -H "X-Auth-Token:$OS_TOKEN" -d #single-server-template.json https://$OS_HOST_URL:8004/v1/$OS_PROJECT_ID/stacks
I've been at it for hours but no matter what I send I get a 400 error:
{"code": 400, "title": "Bad Request", "explanation": "The server could not comply with the request since it is either malformed or otherwise incorrect.", "error": {"type": "HTTPBadRequest", "traceback": null, "message": "The server could not comply with the request since it is either malformed or otherwise incorrect."}}
Things I've tried:
confirmed my environment vars are filled in correctly before sending
confirmed that the template itself is valid by spinning it up from the UI console
confirmed that other endpoints that require auth work as expected
screaming and/or crying
Can anyone confirm that what I've got is correct, or test it against your own openstack instance? The only other thing I can think of is that maybe my openstack provider has an issue with their API

Fleet Telematics Custom Routes

I would like to apply a road restriction using Fleet Telematics API. But everytime I try to use example from the docs, I am getting 400 response. Is this because I am sending parameters incorrectly or it works only for paid plans? I am currently freemium.
HERE example says that overlay_spec needs to be send as a JSON string parameter. Probably that's my issue. Can anyone help me construct proper curl command?
Here is what I am using now:
curl -X GET \
'http://cre.api.here.com/2/overlays/upload.json?app_id=MY_APP_ID&app_code=MY_APP_CODE&map_name=OVERLAYNA&overlay_spec=%5B%0A%20%20%7B%20%22op%22%3A%22override%22%2C%0A%20%20%22shape%22%3A%5B%5B50.10765%2C8.68774%5D%2C%5B50.10914%2C8.68771%5D%5D%2C%0A%20%20%22layer%22%3A%22LINK_ATTRIBUTE_FCN%22%2C%0A%20%20%22data%22%3A%7B%22VEHICLE_TYPES%22%3A%220%22%7D%0A%20%20%7D%2C%0A%20%20%7B%20%22op%22%3A%22create%22%2C%0A%20%20%22shape%22%3A%5B%5B50.10937%2C8.68422%5D%2C%5B50.10807%2C8.68525%5D%2C%5B50.10737%2C8.68387%5D%5D%2C%0A%20%20%22data%22%3A%7B%22NAMES%22%3A%22ENGBNDemo%20Road%22%7D%0A%20%20%7D%2C%0A%20%20%7B%20%22op%22%3A%22override%22%2C%0A%20%20%22shape%22%3A%5B%5B50.10937%2C8.68422%5D%2C%5B50.10807%2C8.68525%5D%2C%5B50.10737%2C8.68387%5D%5D%2C%0A%20%20%22layer%22%3A%22TRUCK_RESTR_FCN%22%2C%0A%20%20%22data%22%3A%7B%22VEHICLE_TYPES%22%3A%22truck%22%2C%20%22WEIGHT_RESTRICTION%22%3A%223300%22%7D%0A%20%20%7D%0A%5D'
Could you please retry your request. Looks like a temporary outage. We tried and was able to get the below response for your above request.
Request:
http://cre.api.here.com/2/overlays/upload.json?map_name=OVERLAYNA&overlay_spec=%5B%7B%22op%22:%22override%22,%22shape%22:%5B%5B50.10765,8.68774%5D,%5B50.10914,8.68771%5D%5D,%22layer%22:%22LINK_ATTRIBUTE_FCN%22,%22data%22:%7B%22VEHICLE_TYPES%22:%220%22%7D%7D%5D&storage=readonly
Response:
{
"layers": [
"LINK_FC3",
"LINK_ATTRIBUTE_FC3",
"TRUCK_RESTR_FC3",
"ROAD_ADMIN_FC3",
"ROAD_GEOM_FC3"
],
"meta": [
{
"layerId": "LINK_FC3",
"lastUpdateTimeStamp": 1542030162597
},
{
"layerId": "LINK_ATTRIBUTE_FC3",
"lastUpdateTimeStamp": 1542030162624
},
{
"layerId": "TRUCK_RESTR_FC3",
"lastUpdateTimeStamp": 1542030162711
},
{
"layerId": "ROAD_ADMIN_FC3",
"lastUpdateTimeStamp": 1542030162843
},
{
"layerId": "ROAD_GEOM_FC3",
"lastUpdateTimeStamp": 1542030162964
}
],
"response_code": "201 Created"
}

Retrieving previously calculated route [HERE Maps] using RouteeId fails with RouteNotReconstructed error

I'm calculating routes based on user input. Then storing the routeId and any additional informations I need. But the shape of the road is something I need occasionally; when the user wants to get a preview of the road again.
Since I don't want to store all the points from shape I tried using getroute endpoint (https://developer.here.com/documentation/routing/topics/resource-get-route.html#resource-get-route) but I get this response:
{
"_type": "ns2:RoutingServiceErrorType",
"type": "ApplicationError",
"subtype": "RouteNotReconstructed",
"details": "Error is NGEO_ERROR_ROUTE_DESERIALIZATION",
"additionalData": [
{
"key": "error_code",
"value": "NGEO_ERROR_ROUTE_DESERIALIZATION"
}
],
"metaInfo": {
"timestamp": "2018-08-01T15:01:56Z",
"mapVersion": "8.30.86.150",
"moduleVersion": "7.2.201830-34436",
"interfaceVersion": "2.6.34",
"availableMapVersion": [
"8.30.86.150"
]
}
}
So the question is: why do I get the error? Following the API documentation https://developer.here.com/documentation/routing/topics/resource-type-error-route-not-reconstructed.html I can exclude wrong routeId (it works for routes saved e.g. today but not for the older ones).
The route was calculated using the same version (7.2)
Is the routeId stored only for a certain amount of time?
If so, how long?
RouteID changes with map version.
https://developer.here.com/documentation/routing/topics/request-route-information.html
You'd need to recalculate periodically to get up to date RouteIDs.

Using nginx to redirect dynamic request

I have a druid service which runs at my local machine at port 8082 as follows:
Method POST: http://localhost:8082/druid/v2/?pretty
Body:
{
"queryType" : "topN",
"dataSource" : "some_source",
"intervals" : ["2015-09-12/2015-09-13"],
"granularity" : "all",
"dimension" : "page",
"metric" : "edits",
"threshold" : 25,
"filter": {
"type": "and",
"fields": [
{
"type": "selector",
"dimension": "pix_id",
"value": "1234"
}
}
}
Hitting this query gives me a list of records based on the value of the dimension 'pix_id'.
Now, I want to setup an nginx such that the external application should not have any clue about my druid service. I just want the external application to hit the URL:
http://localhost:80/pix_id/98765
This url should dynamically generate a JSON with the above mentioned pix_id and send a request to druid and return the response to the user.
Is it possible to do this in nginx?
Yes you can do this, but rather I would suggest to have a php or python script in between to give the results.
So the setup would be -
Have php page receive the request.
make a curl call from php to the druid, locally.
get the result and pass on the response.
There are multiple benefits of doing this eg. -
You completely mask druid, and not necessarily limited to druid.
You can do more calculations in php before sending the request to druid.
caching at php end.

Meteor HTTP post request not working with google add place api

I am using a HTTP post request to add places with google api in meteor js. The code I used is
var url = "https://maps.googleapis.com/maps/api/place/add/json?key="+googleKey;
Meteor.http.post(url,
{params: {
"location": {
"lat": -33.8669710,
"lng": 151.1958750
},
"accuracy": 50,
"name": "Google Shoes!",
"phone_number": "(02) 9374 4000",
"address": "48 Pirrama Road, Pyrmont, NSW 2009, Australia",
"types": ["shoe_store"],
"website": "http://www.google.com.au/",
"language": "en-AU"
}
},function(err, result){
console.log(arguments);
})
Am getting an error
{ [Error: failed [400] { "status" : "REQUEST_DENIED" } ]
I had tried with changing the params and googleKey,but there is no change in the error. Can somebody help me to use http post request with google api? Thanks in advance
Did you try data in place of params ?
Meteor.http.post(url,
{data: {
"location": {
"lat": -33.8669710,
"lng": 151.1958750
},
"accuracy": 50,
"name": "Google Shoes!",
"phone_number": "(02) 9374 4000",
"address": "48 Pirrama Road, Pyrmont, NSW 2009, Australia",
"types": ["shoe_store"],
"website": "http://www.google.com.au/",
"language": "en-AU"
}
},function(err, result){
console.log(arguments);
})
Works fine on my remote server, but in localhost I have an INVALID_REQUEST response, due to the key I think.
Based on the FAQs of the Places API documentation
The "status": "REQUEST_DENIED" is returned by the Google Places API Web Service when:
You have not activated the Google Places API Web Service in the Google Developers Console.
The key parameter is missing from your request.
The key parameter does not match the your API key in the Google Developers Console.
Your API key has not been correctly set up in the Google Developers Console:
If you are using a browser key, check that your allowed referer(s) are correct.
If you are using a server key, check that your allowed IP(s) are correct.
Android and iOS keys are not supported, please use a Browser or Server key.
The request was not sent as an HTTPS request, HTTPS is required for all Google Places API Web Service requests.
The incorrect HTTP method was used to send the request:
All requests must be sent as a GET request except for Place Add.
All Place Add requests must be sent as a POST request.
The request body you specified looks complete, you can check out the Google Developer Console if you missed some configuration on it.
Hope this helps!

Resources