HERE tour planning api problem with multiple delivery in single job - here-api

We are implementing route optimization for a fleet management system, there we have a case like that in a single Job we have 1 pickup and 10 delivery point. so for this solution we are using VRP Multi-jobs.
It's working fine until 3 delivery points but when delivery point is more then 3 then is showing some errors
{
"title": "OpenApi validation error",
"status": 400,
"code": "E613000",
"cause": "[Path '\/plan\/jobs\/1\/tasks\/deliveries'] Array is too long: must have
at most 3 elements but instance has 4 elements",
"action": "Problem definition is not consistent with the specification. Please
correct problem and send it again.",
"correlationId": "15fd607c-b53c-42fa-8317-ef60fcc4bedd"
}
How can we solve this things?

The error description has the solution for the issue faced: max of the delivery/pickups Is 3 per job. It’s limitation of the current implementation that is mentioned in the API spec:
The option to solve the issue is to split tasks to separate jobs. In case of using 1 vehicle pickup job could have earlier time window than delivery jobs.
KS

Related

How do use REST API in Marketo to add leads as members into Programs?

How do you use REST API in Marketo to add leads as members into programs?
I have created folders, programs and leads using REST API.
Now I want to add specific leads by using their ID into Programs as members.
How do I do it using REST API or do I need to use a different method?
Please let me know.
Use the "Change Lead Program Status" End point: http://developers.marketo.com/rest-api/endpoint-reference/lead-database-endpoint-reference/#!/Leads/changeLeadProgramStatusUsingPOST
Example call:
POST /rest/v1/leads/programs/{programId}/status.json
data={
"status": "Registered",
"input": [
{"id": 123}
]
}
So you can add up to 300 Lead IDs, but only 1 status at a time (for 1 Program).

Mobile data reported in GA Measurement Protocol appear in realtime but not in daily summary

I've been attempting to log activity on a mobile-like device using the Google Analytics Measurement Protocol. All of these attempts have validated using the validation URL, and I can see activity when I look at the real-time reports on the Analytics website. But when I look at the Home or Overview reports for the day - no activity is shown.
The view is set for "All Mobile App Data".
The POST body looks something like this:
v=1&tid=UA-000000000-1&ds=app&qt=1601&uid=uid-zzzzz&t=screenview&cd=Foo&an=Foo%20App%20Name&aid=com.example.foo&aiid=com.example.foo&av=0.0.1&ua=Mozilla%2F5.0%20(Linux%3B%20Android%207.0%3B%20SM-G930V%20Build%2FNRD90M)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F59.0.3071.125%20Mobile%20Safari%2F537.36
The ua field is just a pre-defined string. I found that if I omitted it, the Real Time monitoring listed the hits as desktop hits, although I was in a Mobile report and the ds field was "app".
Am I missing a field that is required? Is there some reason why it is showing up in the real-time report, but not in a daily report? Is there some other way to diagnose why the data is vanishing, or confirm the data is actually being captured?
When i check the debug endpoint the hit is valid
Request:
https://www.google-analytics.com/debug/collect?v=1&tid=UA-XXX-1&ds=app&qt=1601&uid=uid-zzzzz&t=screenview&cd=Foo&an=Foo%20App%20Name&aid=com.example.foo&aiid=com.example.foo&av=0.0.1&ua=Mozilla%2F5.0%20(Linux%3B%20Android%207.0%3B%20SM-G930V%20Build%2FNRD90M)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F59.0.3071.125%20Mobile%20Safari%2F537.36
Response
{
"hitParsingResult": [ {
"valid": true,
"parserMessage": [ ],
"hit": "/debug/collect?v=1\u0026tid=UA-53766825-1\u0026ds=app\u0026qt=1601\u0026uid=uid-zzzzz\u0026t=screenview\u0026cd=Foo\u0026an=Foo%20App%20Name\u0026aid=com.example.foo\u0026aiid=com.example.foo\u0026av=0.0.1\u0026ua=Mozilla%2F5.0%20(Linux%3B%20Android%207.0%3B%20SM-G930V%20Build%2FNRD90M)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F59.0.3071.125%20Mobile%20Safari%2F537.36"
} ],
"parserMessage": [ {
"messageType": "INFO",
"description": "Found 1 hit in the request."
} ]
}
I cannot use one of the mobile libraries from Firebase - this is not one of the platforms they support. I do not wish to pretend this is a web page - there is no associated hostname or path. I do not wish to use Events since I can't do event Behavior Flow, which is one of the things I'm interested in seeing.
I'm aware that it can sometimes take "a day or so" for results to first appear. The site was setup over five days ago at this point, and has received data during that time.
Good thought about the anti-spam setting, however the setting appears to be correct:
I've also tried using GET instead of POST - no change, it still shows the hit in real-time, but then it vanishes.
However, I know that it can record hits permanently. There were two hits from a spammer in Russia that have shown up in the daily report (I wasn't there to see it show up in real-time). I don't know what they did, but would love to find out since it might help figure out how I can add a record.
In the real-time reports, it correctly points out the data center all the hits are coming from. Perhaps that is filtering it out somewhere out of my control?
Try adding Cid I know it says this is an optional parameter but for mobile accounts I belive it may be required.
Client ID
Optional.
This field is required if User ID (uid) is not specified in the request. This anonymously identifies a particular user, device, or browser instance. For the web, this is generally stored as a first-party cookie with a two-year expiration. For mobile apps, this is randomly generated for each particular instance of an application install. The value of this field should be a random UUID (version 4) as described in http://www.ietf.org/rfc/rfc4122.txt.
Example value: 35009a79-1a05-49d7-b876-2b884d0f825b
Although this says it needs to be a UUIDv4, it does work with other UUIDs (I've tested it with a v5, which is a hash against the value used for the uid parameter).

To get more than 5 reviews from google places API

I am doing an application where I extract the google reviews using google places API.When I read the document related to it in "https://developers.google.com/maps/documentation/javascript/places",I found out that I could get only 5 top reviews.Is there any option to get more reviews.
In order to have access to more than 5 reviews with the Google API you have to purchase Premium data Access from Google.
That premium plan will grant you access to all sorts of additional data points you have to shell out a pretty penny.
If you are a Business owner wanting to retrieve all of your reviews, you can do so but first you have to get verified and could do this through the MyBusiness API more info here: https://developers.google.com/my-business/
There is a feature request for that: Issue 7630: Response to Include More Than 5 Reviews ─ I'd recommend you "star" it to receive updates.
Unfortunately there's no way to get more than 5 reviews in the places API unless you are the business owner after getting verified as Tekill said.
But it looks like there are some external services that can get all the reviews. My guess is that they scrape them from Google Maps directly:
Some of these services are Wextractor, ReviewShake and AllReviews
Alternatively, you can use a third party solution like SerpApi to scrape all the reviews of any place. It's a paid API with a free trial.
Each page fatches 10 results. To implement the pagination just use the start parameter which defines the result offset (e.g., 0 (default) is the first page of results, 10 is the 2nd page of results, 20 is the 3rd page of results, etc.)
Example python code (available in other libraries also):
from serpapi import GoogleSearch
params = {
"engine": "google_maps_reviews",
"place_id": "0x89c259a61c75684f:0x79d31adb123348d2",
"api_key": "SECRET_API_KEY"
}
search = GoogleSearch(params)
results = search.get_dict()
reviews = results['reviews']
Example output:
"reviews": [
{
"user": {
"name": "Waylon Bilbrey",
"link": "https://www.google.com/maps/contrib/107691056156160235121?hl=en-US&sa=X&ved=2ahUKEwiUituIlpTvAhVYCc0KHbvTCrgQvvQBegQIARAx",
"thumbnail": "https://lh3.googleusercontent.com/a-/AOh14GjOj6Wjfk1kSYjhvH7WIBNMdl4nPj6FvUhvYcR6=s40-c0x00000000-cc-rp",
"reviews": 1
},
"rating": 4,
"date": "a week ago",
"snippet": "I've been here multiple times. The coffee itself is just average to me. The service is good (the people working are nice). The aesthetic is obviously what brings the place some fame. A little overpriced (even for NY). A very small cup for $6 where I feel like the price comes from the top rainbow foam decor , when I'm going to cover it anyways. If it's for an insta pic then it may be worth it?"
},
{
"user": {
"name": "Amber Grace Sale",
"link": "https://www.google.com/maps/contrib/106390058588469541899?hl=en-US&sa=X&ved=2ahUKEwiUituIlpTvAhVYCc0KHbvTCrgQvvQBegQIARA7",
"thumbnail": "https://lh3.googleusercontent.com/a-/AOh14Gj84nHu_9V_0V4yRbZcr-8ZTYAHua6gUBP8fC7W=s40-c0x00000000-cc-rp-ba3",
"local_guide": true,
"reviews": 33,
"photos": 17
},
"rating": 5,
"date": "2 years ago",
"snippet": "They really take pride in their espresso roast here and the staff is extremely knowledgeable on the subject. It’s also a GREAT place to do work although a table is no guarantee; you might have to wait for a bit. My almond milk cappuccino was very acidic at the end which wasn’t expected but I could still tell the bean was high quality. Their larger lattés they put in a tall glass cup which looks really really cool. Would definitely go again.",
"likes": 2,
"images": [
"https://lh5.googleusercontent.com/p/AF1QipMup24_dHrWtNN4ZD70EPsiRMf_tykcUkPw6A1H=w100-h100-p-n-k-no"
]
},
{
"user": {
"name": "Kelvin Petar",
"link": "https://www.google.com/maps/contrib/100859090874785206875?hl=en-US&sa=X&ved=2ahUKEwiUituIlpTvAhVYCc0KHbvTCrgQvvQBegQIARBG",
"thumbnail": "https://lh3.googleusercontent.com/a-/AOh14GhdIvUDamzfPqbYIpwhnGJV2XWSi77iVXfEsiKS=s40-c0x00000000-cc-rp",
"reviews": 3
},
"rating": 4,
"date": "3 months ago",
"snippet": "Stumptown Cafe is the perfect place to work or catch up with friends. Never too loud, never too dead. Their lattes and deliciously addicting and the toasts are tasty as well. Wifi is always fast, which is a huge plus! The staff are the friendliest, I highly recommend this place!"
},
...
]
You can check out the documentation for more details.
Disclaimer: I work at SerpApi.
Adding to the answer of #miguev, there's at the moment no way to get more than 5 top reviews without using premium APIs (according to a Google Maps guy I had a talk with) and that's pricey.
We tried to sign for The Google Maps Platform Premium Plan to show them on pages like this but Google said it's no longer available for sign up or new customers. Right now we're limited to 5 reviews only.

Infinite loop calling getSiteRefreshInfo

About 2 weeks ago I wrote a program implementing the Add Site Account flow chart.
I ran it a number of times over a span of several days, and it worked fine each time.
Then I worked on other things, and about a week later tried running the above program again. Now it did not work, but got into a seemingly infinite loop on the call to getSiteRefreshInfo (the loop in the lower left corner of the flow chart.) I tried running this a number of times over the next 3-4 days, and got into a loop each time. It looped for 20-30 minutes before I killed the program. This is exactly the same source code that worked correctly a week earlier, using exactly the same credentials.
Each time "code" was 0, and "siteRefreshStatus" was "LOGIN_SUCCESS", which according to the flowchart meant I should wait 2-4 seconds and then repeat the call:
{
"siteRefreshStatus": {
"siteRefreshStatusId": 2,
"siteRefreshStatus": "LOGIN_SUCCESS"
},
"siteRefreshMode": {
"refreshModeId": 2,
"refreshMode": "NORMAL"
},
"updateInitTime": 1418945894,
"nextUpdate": 1418946794,
"code": 0,
"itemRefreshInfo": [
{
"memItemId": 10070147,
"itemSuggestedFlow": {
"suggestedFlowId": 2,
"suggestedFlow": "REFRESH"
},
"errorCode": 405,
"retryCount": 0
}
],
"noOfRetry": 0
}
The account I'm passing to addSiteAccount1 is an American Express credit card account, and this is the only account I've added for this user (in other words, this is the only account that needs to be refreshed). Once while the program was in a loop, I manually logged onto the American Express website using these same credentials, and I could view the account, get the list of recent transactions, etc. I realize that Yodlee probably uses a different interface than the browser does, but this did show me that the Amex website was up and functional.
I tried letting the loop run for more than 30 minutes to see what happened. After an hour and 55 minutes I got this exception:
{
"errorOccurred": "true",
"exceptionType": "Unknown Exception Occurred",
"referenceCode": "_022c5fa3-3933-4491-b390-1150d8b28ab3",
"detailedMessage": "Technical Difficulty Processing Request"
}
I tried running the program various times over the next 3-4 days and it got into a loop each time. Then it abruptly started running correctly again, and at the moment is still running correctly. Note that the exact same source code and credentials ran correctly for a while, then got into a loop for 3-4 days, and is now running correctly again.
I have two questions about this:
1) How should I exit from such a loop? The way I interpret the API Flowchart is that I should loop until I get a value for "code" or "siteRefreshStatus" that tells me to exit the loop. I could easily implement my own timer, but I don't know what time value would be appropriate in all cases. Yodlee is in a better position to know if the loop has gone on for too long, so I would expect a return like REFRESH_TIMED_OUT in this case.
2) If we had been running this code in production, we would not have been able to refresh this customer's information for at least 3 days, which for our application would be an extremely long time. Is there anything else we can try in this case?
Thanks!!!
I think you're suffering from a different issue: your itemRefreshInfo has error code 405, which this page says is: "Update Request Canceled(405):Your account was not updated because you canceled the request."
I believe you're cancelling your request somehow.

Array with type map

So here is the array
parts:[map[content:Phillip,
This section pertains to terminated employees who are paid out in the year following the termination event. The way the tax law works, the tax basis for your share distribution will be based on the closing stock price the day preceding notification to the transfer agent. As such, we will distribute net shares calculating the proper withholding at fair market value the day prior to notifying the transfer agent. We will be distributing the shares reflected on your 9/30/01 statement (6,606 shares plus cash for fractional shares). If you would prefer to settle the taxes with a personal check, we can distribute gross shares. Please let me know you preference.
As you know, we are in the process of transferring recordkeeping services from NTRC to Hewitt. As such, we have a CPA, Larry Lewis, working with us to audit and set up transition files. He has become our department expert on the PSA account (much more knowledgeable than myself) and the various plan provision amendments. If you would like, we can set up a conference call with you, myself, and Larry to go over the payment methodology. Please let me know a date and time that is convenient for you.
Thanks,
Renee
-----Original Message-----
From: Allen, Phillip K.
Sent: Thursday, November 01, 2001 8:26 AM
To: Ratcliff, Renee
Subject:
Renee,
Thank you for digging in to the issue of Deferred Phantom Stock Units. It is clear that the payment will be made in shares. However, I still don't understand which date will be used to determine the value and calculate how many shares. The plan document under VII. Amount of Benefit Payments reads "The value of the shares, and resulting payment amount will be based on the closing price of Enron Corp. common stock on the January 1 before the date of payment, and such payment shall be made in shares of Enron Corp. common stock." Can you help me interpret this statement and work through the numbers on my account.
Thank you,
Phillip Allen
contentType:text/plain]]
The issue I am running into is trying to "content" I have tried things like
t := v["parts"][0].(map[string]interface{})
and that didn't work as well as a few other things that got me further down a rabbit hole.
the parts is inside of another map string interface.
This is the error that i keep getting
panic: interface conversion: interface is []interface {}, not map[string]interface {}
Here is the JSON object I am parsing.
{
"X-cc": "",
"From": "renee.ratcliff#enron.com",
"X-Folder": "\\PALLEN (Non- Privileged)\\Allen, Phillip K.\\Inbox",
"Content-Transfer-Encoding": "7bit",
"X-bcc": "", "X-Origin": "Allen-P",
"To": ["k..allen#enron.com"],
"parts": [{
"content": "Phillip,\r\n\r\nThis section pertains to terminated employees who are paid out in the year following the termination event. The way the tax law works, the tax basis for your share distribution will be based on the closing stock price the day preceding notification to the transfer agent. As such, we will distribute net shares calculating the proper withholding at fair market value the day prior to notifying the transfer agent. We will be distributing the shares reflected on your 9/30/01 statement (6,606 shares plus cash for fractional shares). If you would prefer to settle the taxes with a personal check, we can distribute gross shares. Please let me know you preference.\r\n\r\nAs you know, we are in the process of transferring recordkeeping services from NTRC to Hewitt. As such, we have a CPA, Larry Lewis, working with us to audit and set up transition files. He has become our department expert on the PSA account (much more knowledgeable than myself) and the various plan provision amendments. If you would like, we can set up a conference call with you, myself, and Larry to go over the payment methodology. Please let me know a date and time that is convenient for you.\r\n\r\nThanks,\r\n\r\nRenee\r\n\r\n -----Original Message-----\r\nFrom: \tAllen, Phillip K. \r\nSent:\tThursday, November 01, 2001 8:26 AM\r\nTo:\tRatcliff, Renee\r\nSubject:\t\r\n\r\nRenee,\r\n\r\nThank you for digging in to the issue of Deferred Phantom Stock Units. It is clear that the payment will be made in shares. However, I still don't understand which date will be used to determine the value and calculate how many shares. The plan document under VII. Amount of Benefit Payments reads \"The value of the shares, and resulting payment amount will be based on the closing price of Enron Corp. common stock on the January 1 before the date of payment, and such payment shall be made in shares of Enron Corp. common stock.\" Can you help me interpret this statement and work through the numbers on my account.\r\n\r\nThank you,\r\n\r\nPhillip Allen\r\n\r\n",
"contentType": "text/plain"}],
"X-FileName": "PALLEN (Non-Privileged).pst",
"Mime-Version": "1.0",
"X-From": "Ratcliff, Renee </O=ENRON/OU=NA/CN=RECIPIENTS/CN=RRATCLI>",
"Date": {"$date": 1004725111000},
"X-To": "Allen, Phillip K. </O=ENRON/OU=NA/CN=RECIPIENTS/CN=Pallen>",
"Message-ID": "<19495537.1075862165839.JavaMail.evans#thyme>",
"Content-Type": "text/plain; charset=us-ascii", "Subject": "RE:"
}
Here is the code.
http://play.golang.org/p/rJPTjvoM_t
Please post an actual example of what you have tried and what you are trying to do.
arrays of maps and maps of array behave like any other types.
In your example, it looks like you want a map[string][]map[string]interface{} but you have map[string][]interface{} with the content of your interface being an []interface{}
Here are some example of use of maps/interface/array/slices + a the failure that you shown. (http://play.golang.org/p/gmH_nVPppx)
package main
import "fmt"
type Content struct {
name string
}
func main() {
arrayOfMap := [2]map[string]Content{
{"part1": {name: "Philip"}},
{"part2": {name: "John"}},
}
fmt.Printf("%s\n", arrayOfMap[0]["part1"].name)
mapOfArray := map[string][2]Content{
"parts": {
{name: "Philip"},
{name: "John"},
},
}
fmt.Printf("%s\n", mapOfArray["parts"][0].name)
mapOfArrayOfMap := map[string][2]map[string]Content{
"parts": {
{"subpart": Content{name: "Philips"}},
},
}
fmt.Printf("%s\n", mapOfArrayOfMap["parts"][0]["subpart"].name)
mapOfArrayOfInterface := map[string][2]interface{}{
"parts": {
map[string]interface{}{"content": Content{name: "Philips"}},
},
}
fmt.Printf("%s\n", mapOfArrayOfInterface["parts"][0].(map[string]interface{})["content"].(Content).name)
mapOfArrayOfSliceInterface := map[string][2][]interface{}{
"parts": {
{
map[string]interface{}{
"content": Content{name: "Philips"},
},
},
},
}
fmt.Printf("%s\n", mapOfArrayOfSliceInterface["parts"][0][0].(map[string]interface{})["content"].(Content).name)
v := map[string][]interface{}{
"parts": []interface{}{
0: []interface{}{nil},
},
}
// This will fail as shown in the given example.
fmt.Printf("%s\n", v["parts"][0].(map[string]interface{}))
}
Ok so after taking numerous things from the comments above... I want to say what #creack had was the closest thing to being able to get the value of "content" from the multi dimensional interface type is the link below.
http://play.golang.org/p/urBQ8NxSo8

Resources