Where can I find the static.json for TRAFFIC_PATTERN to convert tile output after calculateroute - here-api

I am updating current processes to use the new Routing and Maps APIs scheduled for September.
Assuming a route match that requests the TRAFFIC_PATTERN layer data
curl --location --request POST 'https://routematching.hereapi.com/v8/calculateroute.json?routeMatch=1&mode=fastest;truck;traffic:disabled&apiKey=xxxxxx&filetype=CSV&routemode=truck&attributes=SPEED_LIMITS_FCn(*),TRAFFIC_PATTERN_FCn(*),LINK_ATTRIBUTE_FCn(*)' \
--header 'Content-Type: text/plain' \
--data-raw 'LATITUDE,LONGITUDE,TIMESTAMP,SPEED_MPH
42.47051,-83.04737,2020-07-14T10:09:48.025Z,0
'
The response includes the TRAFFIC_PATTERN Json like the following
"TRAFFIC_PATTERN_FCN": [
{
"FUNCTIONAL_CLASS": "5",
"AVG_SPEED": "8",
"TRAVEL_DIRECTION": "B",
"F_WEEKDAY": "907,907,907,907,907,907,907",
"T_WEEKDAY": "907,907,907,907,907,907,907",
"FREE_FLOW_SPEED": "10"
}
]
Prior to this code change I would use a lookup of static.json of the free flow PATTERN_IDs using the old URI
curl --location --request GET 'https://s.fleet.ls.hereapi.com/1/static.json?apiKey=xxxxxxx&content=TRAFFIC_PATTERN'
To do the lookup for the PATTERN_ID (907)
{
"PATTERN_ID": "907",
"SPEED_VALUES": "10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10"
},
I keep going around in circles with the HERE documentation which takes me to the same place every time
https://developer.here.com/documentation/route-matching/dev_guide/topics/here-map-content.html
This only highlights the first part of getting the TRAFFIC_PATTERN and not how to determine the PATTERN_ID lookup.
Can someone responsible for the new HERE documentation or has had it better explained please tell me how this is going to be done when s.fleet.ls.hereapi.com is deprecated?

I think you can use HERE Map Attributes API v8. This is replacing HERE Fleet Telematics API to get the map content.
For example you can use follow URL: https://pde.api.here.com/1/static.json?apiKey=F1UqxQFs8A7-zSUS7Hs8E5zT-pntHaH2CsQaVmtZ85s&content=TRAFFIC_PATTERN to do the lookup for pattern_id
Regards.

Related

How to get post reactions using linkedin marketing 2022 API

I am trying to get the list of reactions for linkedin post (called share in linkedin namespace)
the reference documentation is https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/reactions-api?view=li-lms-2022-12&tabs=http
NOTE: I am using marketing API December 2022
I am trying to get the post on my own test page where i am an admin.
List of permissions my token has are: SCOPE = "r_organization_social,w_member_social,r_1st_connections_size,r_organization_admin,r_ads_reporting,r_emailaddress,r_basicprofile,r_ads"
as it says in above mentioned documentation, the first one r_organization_social should be enough.
in documentation it says:
GET https://api.linkedin.com/rest/reactions/(actor:{personUrn|organizationUrn},entity:{shareUrn|ugcPostUrn|commentUrn})
for example organization_urn = urn:li:organization:12345678
and post urn = urn:li:share:7028701695735914497
how does the correct query looks like?
api.linkedin.com/rest/reactions/urn:li:share:7028701695735914497
api.linkedin.com/rest/reactions/(entity:urn:li:share:7028701695735914497)
api.linkedin.com/rest/reactions/entity:urn:li:share:7028701695735914497
api.linkedin.com/rest/reactions/urn:li:organization:12345678,urn:li:share:7028701695735914497
api.linkedin.com/rest/reactions/(urn:li:organization:12345678,urn:li:share:7028701695735914497)
api.linkedin.com/rest/reactions/(actor:urn:li:organization:12345678,entity:urn:li:share:7028701695735914497)
api.linkedin.com/rest/reactions/actor:urn:li:organization:12345678,entity:urn:li:share:7028701695735914497
api.linkedin.com/rest/reactions?q=entity&entity=urn:li:share:7028701695735914497
etc...
most of those queries return error:
{'status': 403, 'serviceErrorCode': 100, 'code': 'ACCESS_DENIED', 'message': 'Unpermitted fields present in RESOURCE_KEY: Data Processing Exception while processing fields [/reactionsId]'}
or maybe I am missing something?
i can retrieve a summary or even list of likes and comments using socialActions endpoint, but that list does not contain the reaction type.
by the way the socialactions endpoint is pretty straightforward:
curl -X GET 'https://api.linkedin.com/rest/socialActions/urn:li:share:7028701695735914497' \
-H 'Authorization: Bearer {INSERT_TOKEN}'
-H 'LinkedIn-Version: 202212' \
returns a summary of likes and comments
https://api.linkedin.com/rest/socialActions/urn:li:share:7028701695735914497/likes returns list of likes objects with authorids
https://api.linkedin.com/rest/socialActions/urn:li:share:7028701695735914497/comments returns list of comments objects

Remove Subscription line items via API for items that no longer exist in WooCommerce Store

Background:
I have about 1000 subscriptions that I need to run through and delete line items. Woocommerce has somehow allowed us to delete products that are tied to subscriptions, meaning there are now up to 1000 subscriptions with products in them which no longer exist.
This creates many problems for the subscribers, such as not being able to manually renew, as they get errors for the products that do not exist.
I can delete them manually, where I will click into a subscription and remove 10+ items 1 by 1 per subscription. This will take way too long manually.
What I’m trying to do:
I want to run through all the subscriptions 1 by 1, look through the line items, and remove any line items where the “parent_id” is 0.
What I have tried so far:
I’ve tried many variations of the JSON below (also both with and without the 'subscription' line), and this is where I am at currently.
See API info here
See line item info here
NOTE: I get no error messages, the request reponse is 200. But no items are removed...
curl -X PUT https://example.com/wp-json/wc/v3/subscriptions/{subscriptions_id} \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"subscription":{
"line_items":[
{
"product_id":0,
"quantity":0
}
]
}
}'
What I would like help with:
At the very least to know if I'm on the right track, or if what I'm trying to do is even possible. But ideally, to point me in the right direction, or help fix up my API request.
Thanks in advance!!
NOTE 2:
I can't use AutomateWoo for this, as AutomateWoo requires the product to exist before you can select it / remove it.
Figured it out...
So you need to refer to the line item by using 'id' and not 'product_id' if you want to remove it. Because the 'id' is never empty (even if the product doesn't exist), I had to build a complex automation using different API endpoints.
You need to
list all subscriptions
have automation run through line items per subscription, only allowing ones with product_id = 0 to pass
run the proper JSON to delete the line items referencing the 'id'
{
"line_items": [{
"id": 18756,
"quantity": 0
}]
}

HERE LinkId from route not found in PDE (Platform Data Extension)

UPDATE: It's happening again, also with Fleet API. Please see additional examples at end of the post.
I'm using HERE's REST API to calculate a route, then ask for additional data for each link / route segment by querying HERE's Platform Data Extension (PDE). This usually works fine, but now I've run into a link id that is not recognised by PDE.
Are these services not in sync, or am I doing something wrong?
I didn't have any issue in the past weeks, and it still works fine for most link ids, so this could either be a new problem or a very singular issue. I searched in the HERE API documentation and on Stackoverflow, but couldn't find anything related.
Route request (A24 Berlin towards Hamburg): https://route.api.here.com/routing/7.2/calculateroute.json?waypoint0=geo!52.7091,13.0356&waypoint1=geo!52.7193,12.9608&mode=fastest;car;traffic:disabled&representation=navigation&app_id=xxx&app_code=yyy
The json response (below) contains a link with permanent id 1199057935 at Anschlussstelle Kremmen.
The PDE request gives an empty response: https://pde.api.here.com/1/index.json?layer=ROAD_GEOM_FCn&attributes=LINK_ID&values=1199057935&app_id=xxx&app_code=yyy
{"Layers":[]}
Instead, I would expect the data of the containing tile, e.g. what I get for 1199057936
{"Layers":[{"layer":"ROAD_GEOM_FC1","level":9,"tileXYs":[{"x":548,"y":405}]}]}
I also tried the PDE request with ROAD_GEOM_FC1 and prefixing the id with + (values=+1199057935). Other link ids of the route return the expected tile information.
For completeness, here's the link's json from the routing response:
{
"linkId":"+1199057935",
"shape":["52.7175629,12.976613","52.7177131,12.9749393"],
"firstPoint":28,
"lastPoint":29,
"length":114,
"remainDistance":1095,
"remainTime":39,
"nextLink":"+1199057936",
"maneuver":"M2",
"speedLimit":33.3333359,
"dynamicSpeedInfo":{"trafficSpeed":16.3888893,"trafficTime":7,"baseSpeed":27.5,"baseTime":4,"jamFactor":5.7118645},
"flags":["motorway"],
"functionalClass":1,
"roadNumber":"A24",
"timezone":"+0100",
"roadName":"",
"consumption":0,
"_type":"PrivateTransportLinkType"
}
UPDATE 2019-05-27:
I get a route that contains link id 1239826684 from https://route.api.here.com/routing/7.2/calculateroute.json?waypoint0=geo!52.5066,13.4299&waypoint1=geo!52.5282,13.4265&mode=fastest;car;traffic:disabled&representation=navigation&app_id=xxx&app_code=yyy
Using fleet endpoint redirects to same call as above, including link id 1239826684: https://fleet.api.here.com/2/calculateroute.json?waypoint0=geo!52.5066,13.4299&waypoint1=geo!52.5282,13.4265&mode=fastest;car;traffic:disabled&representation=navigation&app_id=xxx&app_code=yyy
PDE returns [] for that link id: https://pde.api.here.com/1/index.json?layer=ROAD_GEOM_FCn&attributes=LINK_ID&values=1239826684&app_id=xxx&app_code=yyy
Fleet API returns [] for that link id: http://fleet.cit.api.here.com/1/index.json?layer=ROAD_GEOM_FCn&attributes=LINK_ID&values=1239826684&app_id=xxx&app_code=yyy
Seems the underlying geo-data is not in sync, and using different APIs does not help. Any other solution?
You can try Fleet telematics group of API's over basic routing and PDE as Fleet Telematics provides whole routing solution .
Please find the below API request which is giving expected response for the id-1199057935
http://fleet.cit.api.here.com/1/index.json?layer=ROAD_GEOM_FCn&attributes=LINK_ID&values=1199057935&app_id=xxxx&app_code=yyyy
Response :
{
Layers: [
{
layer: "ROAD_GEOM_FC1",
level: 9,
tileXYs: [
{
x: 548,
y: 405
}
]
}
]
}
for more information kindly go through the below documentation
https://developer.here.com/documentation/fleet-telematics/api-reference.html#operation%2FindexJSONUsingGET
Hope this will help.

Fleet Telematics Route Matching, query more attributes for each route link

I'm evaluating the Fleet Telematics Route Matching service and i'm trying to retrieve more link attributes directly in the response. How can this be achieved?
I created a Freemium account on HERE.com and tried the basic example from the documentation: https://developer.here.com/documentation/route-match/topics/quick-start-gps-trace-route.html.
In the documentation of the service i found that it should be possible to get more attributes regarding the route links returned in the response: https://developer.here.com/documentation/route-match/topics/attributes-along-route.html
The following works (of course 123 is not my real app id, nor my real app code):
curl -v --request GET "https://rme.cit.api.here.com/2/matchroute.json?app_id=123&app_code=123&routemode=car&file=UEsDBBQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAc2FtcGxlLXRyYWNlLmdweIXPTQuCMBwG8HufQnZv%2F605S0k9djEIungdZjpSJ27kPn6%2BRBgYXcYYv2cPzzG2deU8805L1YSIYoLiaHMsWvv9uBlYowOrZYhKY9oAoO973DOsugJ2hFBIz8k1K%2FNabGWjjWiy%2FJ36ShjVqqITd2lxpmo4XVKgMP6vZaCneKIyYabivzHnr4BhCbb6hoZRpnvMp86L%2BdIapxImRJxiSuh%2Bj5xq7CWY%2Bcz1EaypA10qxlfVjvOl8rxVxfzDQrk%2FFCfLRs7YpOCzA%2BZd49LoBVBLAQIUABQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAAAAAAAEAIAAAAAAAAABzYW1wbGUtdHJhY2UuZ3B4UEsFBgAAAAABAAEAPgAAAP0AAAAAAA%3D%3D"
and returns:
{"RouteLinks":[{"linkId":25664478,"functionalClass":5,"confidence":1.0,"shape":"51.10168 0.39385 51.10184 0.39329","offset":0.62907,"mSecToReachLinkFromStart":2614,"linkLength":43.08},{"linkId":1022687683,"functionalClass":4,"confidence":1.0,"shape":"51.10184 0.39329 51.10214 0.39345","mSecToReachLinkFromStart":8376,"linkLength":35.21},{"linkId":1022687684,"functionalClass":4,"confidence":1.0,"shape":"51.10214 0.39345 51.10224 0.3935","mSecToReachLinkFromStart":10284,"linkLength":11.66},{"linkId":25664459,"functionalClass":4,"confidence":1.0,"shape":"51.10224 0.3935 51.10232 0.39354","mSecToReachLinkFromStart":11811,"linkLength":9.33},{"linkId":781742854,"functionalClass":4,"confidence":1.0,"shape":"51.10232 0.39354 51.10245 0.39361 51.10255 0.39367","mSecToReachLinkFromStart":16214,"linkLength":27.16},{"linkId":781742855,"functionalClass":4,"confidence":1.0,"shape":"51.10255 0.39367 51.10269 0.39376","mSecToReachLinkFromStart":16255,"linkLength":16.8},{"linkId":25664450,"functionalClass":4,"confidence":1.0,"shape":"51.10269 0.39376 51.10292 0.39391 51.10306 0.39401","mSecToReachLinkFromStart":19004,"linkLength":44.74},{"linkId":25664444,"functionalClass":4,"confidence":1.0,"shape":"51.10306 0.39401 51.10324 0.39413","mSecToReachLinkFromStart":29879,"linkLength":21.72},{"linkId":25664440,"functionalClass":4,"confidence":1.0,"shape":"51.10324 0.39413 51.10335 0.3942 51.1035 0.39431 51.1036 0.39439","mSecToReachLinkFromStart":37082,"linkLength":44.02},{"linkId":25664427,"functionalClass":4,"confidence":1.0,"shape":"51.1036 0.39439 51.10369 0.39446 51.10378 0.39453","mSecToReachLinkFromStart":40731,"linkLength":22.3},{"linkId":860272608,"functionalClass":4,"confidence":1.0,"shape":"51.10378 0.39453 51.10394 0.39465","mSecToReachLinkFromStart":43951,"linkLength":19.68},{"linkId":860272609,"functionalClass":4,"confidence":1.0,"shape":"51.10394 0.39465 51.10417 0.39482","mSecToReachLinkFromStart":44659,"linkLength":28.22},{"linkId":781742870,"functionalClass":4,"confidence":1.0,"shape":"51.10417 0.39482 51.10427 0.39489 51.10439 0.39497 51.10452 0.39505 51.10463 0.39512","mSecToReachLinkFromStart":48568,"linkLength":55.33},{"linkId":1022687692,"functionalClass":4,"confidence":1.0,"shape":"51.10463 0.39512 51.10483 0.39523","mSecToReachLinkFromStart":57622,"linkLength":23.55},{"linkId":1022687693,"functionalClass":4,"confidence":1.0,"shape":"51.10483 0.39523 51.10547 0.39554","offset":0.28475,"mSecToReachLinkFromStart":64944,"linkLength":74.44}],"TracePoints":[{"confidenceValue":1.0,"elevation":0.0,"headingDegreeNorthClockwise":10000.0,"headingMatched":-66.0,"lat":51.10177,"latMatched":51.10178,"linkIdMatched":25664478,"lon":0.39349,"lonMatched":0.3935,"matchDistance":1.46,"matchOffsetOnLink":0.6290743846692971,"minError":1.0,"routeLinkSeqNrMatched":0,"speedMps":0.0,"timestamp":0},{"confidenceValue":1.0,"elevation":0.0,"headingDegreeNorthClockwise":10000.0,"headingMatched":-66.0,"lat":51.10181,"latMatched":51.10182,"linkIdMatched":25664478,"lon":0.39335,"lonMatched":0.39336,"matchDistance":1.46,"matchOffsetOnLink":0.8790743846674338,"minError":1.0,"routeLinkSeqNrMatched":0,"speedMps":0.0,"timestamp":0},{"confidenceValue":1.0,"elevation":0.0,"headingDegreeNorthClockwise":10000.0,"headingMatched":22.0,"lat":51.10255,"latMatched":51.10255,"linkIdMatched":781742855,"lon":0.39366,"lonMatched":0.39367,"matchDistance":1.11,"matchOffsetOnLink":0.0,"minError":1.0,"routeLinkSeqNrMatched":5,"speedMps":0.0,"timestamp":0},{"confidenceValue":1.0,"elevation":0.0,"headingDegreeNorthClockwise":10000.0,"headingMatched":25.0,"lat":51.10398,"latMatched":51.10398,"linkIdMatched":860272609,"lon":0.39466,"lonMatched":0.39468,"matchDistance":1.87,"matchOffsetOnLink":0.1535150210712758,"minError":1.0,"routeLinkSeqNrMatched":11,"speedMps":0.0,"timestamp":0},{"confidenceValue":1.0,"elevation":0.0,"headingDegreeNorthClockwise":10000.0,"headingMatched":17.0,"lat":51.10501,"latMatched":51.10501,"linkIdMatched":1022687693,"lon":0.39533,"lonMatched":0.39532,"matchDistance":1.33,"matchOffsetOnLink":0.2847498087963734,"minError":1.0,"routeLinkSeqNrMatched":14,"* Connection #0 to host rme.cit.api.here.com left intact speedMps":0.0,"timestamp":0}],"Warnings":[],"MapVersion":"LATEST"}
However, my tries to get more attributes regarding the road links have not been successful so far. No matter which attributes i select, the following query does not work:
curl -v --request GET "https://rme.cit.api.here.com/2/matchroute.json?app_id=123&app_code=123&routemode=car&file=UEsDBBQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAc2FtcGxlLXRyYWNlLmdweIXPTQuCMBwG8HufQnZv%2F605S0k9djEIungdZjpSJ27kPn6%2BRBgYXcYYv2cPzzG2deU8805L1YSIYoLiaHMsWvv9uBlYowOrZYhKY9oAoO973DOsugJ2hFBIz8k1K%2FNabGWjjWiy%2FJ36ShjVqqITd2lxpmo4XVKgMP6vZaCneKIyYabivzHnr4BhCbb6hoZRpnvMp86L%2BdIapxImRJxiSuh%2Bj5xq7CWY%2Bcz1EaypA10qxlfVjvOl8rxVxfzDQrk%2FFCfLRs7YpOCzA%2BZd49LoBVBLAQIUABQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAAAAAAAEAIAAAAAAAAABzYW1wbGUtdHJhY2UuZ3B4UEsFBgAAAAABAAEAPgAAAP0AAAAAAA%3D%3D&attributes=LINK_ID"
and instead of a proper response, i just get
{"faultCode":"6a8a9966-b2eb-4a54-8f58-2f36e501bb94","responseCode":"400 Bad Request","message":"Invalid layer attribute parameter."}
Using a layer instead of an attributes does not work either:
curl -v --request GET "https://rme.cit.api.here.com/2/matchroute.json?app_id=123&app_code=123&routemode=car&file=UEsDBBQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAc2FtcGxlLXRyYWNlLmdweIXPTQuCMBwG8HufQnZv%2F605S0k9djEIungdZjpSJ27kPn6%2BRBgYXcYYv2cPzzG2deU8805L1YSIYoLiaHMsWvv9uBlYowOrZYhKY9oAoO973DOsugJ2hFBIz8k1K%2FNabGWjjWiy%2FJ36ShjVqqITd2lxpmo4XVKgMP6vZaCneKIyYabivzHnr4BhCbb6hoZRpnvMp86L%2BdIapxImRJxiSuh%2Bj5xq7CWY%2Bcz1EaypA10qxlfVjvOl8rxVxfzDQrk%2FFCfLRs7YpOCzA%2BZd49LoBVBLAQIUABQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAAAAAAAEAIAAAAAAAAABzYW1wbGUtdHJhY2UuZ3B4UEsFBgAAAAABAAEAPgAAAP0AAAAAAA%3D%3D&attributes=LINK_ATTRIBUTE_FC5"
This returns the same error as above.
Based on the documentation i would expect that there is some way to retrieve more link attributes directly in the response, but i cannot figure out how to do that. Obviously, i must be doing something wrong.
Please refer the following link
https://developer.here.com/documentation/route-match/topics/resource-matchroute-request.html
you can easily retrieve the attributes for the particular layers with the following command where the attributes parameter should be LINK_ATTRIBUTE_FCn(*). It is also possible to retrieve the particular information from these attributes with LINK_ATTRIBUTE_FCn(ISO_COUNTRY_CODE,RAMP,URBAN).
https://rme.cit.api.here.com/2/matchroute.json?app_id=123&app_code=123&routemode=car&file=UEsDBBQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAc2FtcGxlLXRyYWNlLmdweIXPTQuCMBwG8HufQnZv%2F605S0k9djEIungdZjpSJ27kPn6%2BRBgYXcYYv2cPzzG2deU8805L1YSIYoLiaHMsWvv9uBlYowOrZYhKY9oAoO973DOsugJ2hFBIz8k1K%2FNabGWjjWiy%2FJ36ShjVqqITd2lxpmo4XVKgMP6vZaCneKIyYabivzHnr4BhCbb6hoZRpnvMp86L%2BdIapxImRJxiSuh%2Bj5xq7CWY%2Bcz1EaypA10qxlfVjvOl8rxVxfzDQrk%2FFCfLRs7YpOCzA%2BZd49LoBVBLAQIUABQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAAAAAAAEAIAAAAAAAAABzYW1wbGUtdHJhY2UuZ3B4UEsFBgAAAAABAAEAPgAAAP0AAAAAAA%3D%3D&attributes=LINK_ATTRIBUTE_FCn(*)
Similarly, you can get the attributes for the other layers (i.e. ROAD_GEOM_FCn(*))
Hope this helps you.
Best Regards,
Jeyaprakash Rajagopal

How to give empty value for argument in POST request for hyperledger composer rest server

I am trying to make a post request via R using the httr package to composer rest server. I have written a code and then created the composer rest server from it. These are my details
Request URL : http://localhost:3000/api/nl.amis.registry.fruits
Body: {
"$class": "nl.amis.registry.fruits",
"Id": "9",
"name": "orange",
"description": "string",
"count": ""
}
First, I have tried with the composer rest server. For my purpose, I needed the count to be blank and the value will be appended by another API call. I was able to make the transaction successfully with the count: "". This I was able to check in the test section of the composer playground. The remaining code works fine which appends the count variable later on.
Now I am writing an R code to make a similar transaction through POST request. Here I am facing an error that "count cannot be blank" and returns with error 422 Unprocessable entity. The content type I was used was application/json. While using the "count":{} , the post request process fine and i am getting "count":[object Object] in the response. But the later on code which does the appending will do something like count:"[object Object],1" wherein I am expecting "count":"1". Everything works fine while using the test in composer playground but while trying to access externally via rest API is creating the problem. Please help.
you can use an Optional keyword to declare a count in an asset of the model file. using Optional keyword you can post an empty value of count.
for example:
asset fruits identified by Id {
o String Id
o String name
o String description
o String count optional
}

Resources