Fleet Telematics Custom Routes - here-api

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"
}

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

LinkedIn UGC Posts API with projection returns invalid paging URL

I would like to retrieve UGC posts from organization's profile using the ugcPosts API. I would also like to receive links to video streams with the response, so I use the following projection (based on this answer):
(paging,elements*(id,created,specificContent(com.linkedin.ugc.ShareContent(shareMediaCategory,shareCommentary,media(*(media~:playableStreams,originalUrl,description,title,thumbnails))))))
My whole request looks like this (retrieving the posts of the official test organization):
curl --request GET \
--url 'https://api.linkedin.com/v2/ugcPosts?q=authors&sortBy=LAST_MODIFIED&projection=(paging%2Celements*(id%2Ccreated%2ClastModified%2Cauthor%2CspecificContent(com.linkedin.ugc.ShareContent(shareMediaCategory%2CshareCommentary%2Cmedia(*(media~%3AplayableStreams%2CoriginalUrl%2Cdescription%2Ctitle%2Cthumbnails))))))&authors=List(urn%3Ali%3Aorganization%3A2414183)' \
--header 'Authorization: Bearer <ACCESS_TOKEN>' \
--header 'X-Restli-Protocol-Version: 2.0.0'
The request works as fine. But I run into an issue if I want to follow to the next page using the provided URL in paging; this is the relevant response:
{
"paging": {
"total": 284243,
"count": 10,
"start": 0,
"links": [
{
"rel": "next",
"type": "application/json",
"href": "/v2/ugcPosts?q=authors&start=10&count=10&sortBy=LAST_MODIFIED&projection=%28paging%2Celements*%28id%2Ccreated%2ClastModified%2Cauthor%2CspecificContent%28com.linkedin.ugc.ShareContent%28shareMediaCategory%2CshareCommentary%2Cmedia%28*%28media~%3AplayableStreams%2CoriginalUrl%2Cdescription%2Ctitle%2Cthumbnails%29%29%29%29%29%29&authors=List(urn%3Ali%3Aorganization%3A2414183)"
}
]
}
}
On the first page, you can see that parentheses in the projection parameter got URL encoded, while authors parameter remains the same. This request still works, but if I follow the URL one more time, I recieve the following paging data:
{
"paging": {
"total": 284243,
"count": 10,
"start": 10,
"links": [
{
"rel": "prev",
"type": "application/json",
"href": "/v2/ugcPosts?q=authors&start=0&count=10&sortBy=LAST_MODIFIED&projection=%2528paging%252Celements*%2528id%252Ccreated%252ClastModified%252Cauthor%252CspecificContent%2528com.linkedin.ugc.ShareContent%2528shareMediaCategory%252CshareCommentary%252Cmedia%2528*%2528media~%253AplayableStreams%252CoriginalUrl%252Cdescription%252Ctitle%252Cthumbnails%2529%2529%2529%2529%2529%2529&authors=List(urn%3Ali%3Aorganization%3A2414183)"
},
{
"rel": "next",
"type": "application/json",
"href": "/v2/ugcPosts?q=authors&start=20&count=10&sortBy=LAST_MODIFIED&projection=%2528paging%252Celements*%2528id%252Ccreated%252ClastModified%252Cauthor%252CspecificContent%2528com.linkedin.ugc.ShareContent%2528shareMediaCategory%252CshareCommentary%252Cmedia%2528*%2528media~%253AplayableStreams%252CoriginalUrl%252Cdescription%252Ctitle%252Cthumbnails%2529%2529%2529%2529%2529%2529&authors=List(urn%3Ali%3Aorganization%3A2414183)"
}
]
}
}
You can see here that the projection parameter got URL-encoded again (having %252C for parens) and following that URL returns error 400.
I think this is a bug in the API, but since LinkedIn recommends to use Stack Overflow for support, I just wrote this up here, hopeful someone notices. Perhaps could you suggest another way of contacting LinkedIn about this bug in their API?
Meanwhile I resorted to constructing the pagination URL manually.

calculateroute.json giving NGEO_ERROR_GRAPH_DISCONNECTED error

So when I try to call calculateroute.json, I'm getting a NGEO_ERROR_GRAPH_DISCONNECTED error with no further information.
Here's my example call: https://route.api.here.com/routing/7.2/calculateroute.json?app_id=<APP_ID>&app_code=<APP_CODE>&waypoint0=geo!-34.0144128,151.1121957&waypoint1=geo!-33.875455,151.207583&mode=fastest;car;traffic:enabled&departure=2019-11-11T22:27:30
Obviously I've removed our App ID and App Code from that call :).
{
"_type": "ns2:RoutingServiceErrorType",
"type": "ApplicationError",
"subtype": "NoRouteFound",
"details": "Error is NGEO_ERROR_GRAPH_DISCONNECTED",
"additionalData": [
{
"key": "error_code",
"value": "NGEO_ERROR_GRAPH_DISCONNECTED"
}
],
"metaInfo": {
"timestamp": "2019-11-08T00:43:18Z",
"mapVersion": "8.30.102.150",
"moduleVersion": "7.2.201944-5674",
"interfaceVersion": "2.6.74",
"availableMapVersion": [
"8.30.102.150"
]
}
}
Any ideas?
I've tried looking through the docs but it seems I've done everything right and certainly it has worked for us hundreds/thousands of times before.
Indeed, I see the default Routing API does not find a direct route between the start and end waypoints. If you use our advanced Fleet telematics API, it does actually calculates the route.
https://fleet.api.here.com/2/calculateroute.json?app_id=<APP_ID>&app_code=<APP_CODE>&waypoint0=geo!-34.0144128,151.1121957&waypoint1=geo!-33.875455,151.207583&mode=fastest;car;traffic:enabled&departure=2019-11-11T22:27:30
Please use the advanced API if the standard API does not return results.

Ad Targeting - Find Entities by URNs API ClassCastException error message

I have some problem with the "Find Entities by URNs" API in order to retrieve the metadata and value information for a collection of URNs.
If I use the URL described in the doc (Sample request) with a valid access token:
https://api.linkedin.com/v2/adTargetingEntities?q=urns&urns=List(urn%3Ali%3AfieldOfStudy%3A100990,urn%3Ali%3Aorganization%3A1035,urn%3Ali%3Aseniority%3A9)&locale=(language:en,country:US)&oauth2_access_token=<a-valid-token>
I receive the message:
{
"serviceErrorCode": 0,
"message": "java.lang.ClassCastException",
"status": 500
}
Anyone have experience the same issue? Any idea how to fix it?
Also: how can i contact for technical support as in this case?
UPDATE:
I made some try and I fix using the following version:
https://api.linkedin.com/v2/adTargetingEntities?q=urns&urns=urn%3Ali%3AfieldOfStudy%3A100990&urns=urn%3Ali%3Aorganization%3A1035&urns=urn%3Ali%3Aseniority%3A9&locale.language=it&locale.country=IT&oauth2_access_token=<a-valid-token>
BUT the locale/language translation is not working. Could be this a working solutions?
From the support team:
Our docs are missing 1 critical piece of information. Whenever using
LIST and encoded URNs in the URL, we expect an additional header 'x-restli-protocol-version: 2.0.0'
The correct API call would be Request:
curl -X GET \
'https://api.linkedin.com/v2/adTargetingEntities?q=urns&urns=List(urn%3Ali%3Aindustry%3A1,urn%3Ali%3Aseniority%3A9)&locale=(language:it,country:IT)'
\
-H 'x-restli-protocol-version: 2.0.0' \
-H 'Authorization: Bearer <Token>'
Response:
{
"elements": [
{
"facetUrn": "urn:li:adTargetingFacet:industries",
"name": "Difesa e spazio",
"urn": "urn:li:industry:1"
},
{
"facetUrn": "urn:li:adTargetingFacet:seniorities",
"name": "Partner",
"urn": "urn:li:seniority:9"
}
],
"paging": {
"count": 2147483647,
"links": [],
"start": 0
}
}
Yes, it does provide a response in locale.
Hope this can help other guys in the future

Bing Spell Check API - ignoring Gibberish

Its seems like Bing Spell Check API does not work as I excepted.
A lot of mistakes are ignored...
For example:
"lets go to the see and then to gfgdf." response: "flaggedTokens": []
"lets blhblh to the sea" response: "flaggedTokens": []
Where: "lets go to the see" response:
{
"flaggedTokens": [
{
...
"suggestions": [
{
"suggestion": "let's",
}
]
},
{
...
"suggestions": [
{
"suggestion": "sea",
}
]
}
],
"_type": "SpellCheck"
}
Can I do something to get more reliable results?
Thanks
It's worst on my side...
I always got the same result:
{
"_type": "SpellCheck",
"flaggedTokens": []
}
If somebody happens to kown how to prevent that I would like to know.
I guess that's maybe about migrating to Azure. Maybe thoses endpoints are not functionning correctly now.

Resources