Here API findpickups example doesn't work - javascript

We are trying to use the findpickup api to find the best route for several waypoints. Despite the fact that we trying to understand how the pickup and drop params exactly work we were not able to get a successfully response from the example at
https://developer.here.com/documentation/routing-waypoints/dev_guide/topics/example-pickup.html
https://wse.ls.hereapi.com/2/findpickups.json?mode=fastest;car;traffic:disabled&start=waypoint0;50.115620,8.631210;pickup:GRAPEFRUITS,value:1000&departure=2016-10-14T07:30:00+02:00&vehicleCost=0.29&driverCost=20&maxDetour=60&restTimes=disabled&end=waypoint7;50.132540,8.649280&destination0=waypoint1;50.118578,8.636551;drop:APPLES,value:30&destination1=waypoint2;50.122540,8.631070;pickup:BANANAS&destination2=waypoint3;50.128920,8.629830;drop:BANANAS,value:30&destination3=waypoint4;50.118654,8.619956;pickup:APPLES&destination4=waypoint5;50.123998,8.640626;drop:PEACHES,value:50&destination5=waypoint6;50.130299,8.613031;pickup:PEACHES&apiKey={YOUR_API_KEY}
It is always complaining not finding a match for a street.
After finding a similar question on stackoverflow describing this problem
Here Map findpickups Cannot match onto a road link with 1000.0m search radius
we switched to the alternative domain. But now the entire pickup/drop thing confused us even more after reading the error message that drop-off point is missing.
Regardless where we are changing params for pickup/drop it stills complains that a contraint for pickup is not fullfilled.
Would be awesome if someone has any idea what is going wrong with the example from the HERE Docs.
And more importantly if someone can explain how the pickup/drop implementation actually works.
#HERE developer support
Thanks a lot for your reply.
My new additional notes would be too long as a comment. So I edited my questions with further information for describing the actually problem we have.
Obviously makes sense that GRAPEFRUIT has to be removed in a pickup waypoint. We already tried that. Sorry that we didn't mentioned that.
The thing is that in our use case will drop or pickup multiple items on each waypoint.
According docs this must work.
https://developer.here.com/documentation/routing-waypoints/dev_guide/topics/api-reference-type-waypoint.html .
Unfortunately it doesn't work. See following request
https://fleet.ls.hereapi.com/2/findpickups.json?driverCost=20&mode=fastest;car&vehicleCost=0.20&start=wp1;50.41256,8.02943&destination1=wp2;50.0766,8.22699;pickup:item1&destination2=wp3;50.07735,8.22185;pickup:item2&destination3=wp4;50.06563,8.19155;drop:item1,value:100;drop:item2,value:100&end=wp5;50.41256,8.02943&apikey=YOUR_API_KEY
Would love to get some hints and a solution for our use case.

You would have to switch to the new domain https://fleet.ls.hereapi.com/2/findpickups.json and also change the departure time format as well as remove the pickup condition for the GRAPEFRUITS. The below request should work:
https://fleet.ls.hereapi.com/2/findpickups.json?mode=fastest;car;traffic:disabled&start=waypoint0;50.115620,8.631210&driverCost=20&maxDetour=60&restTimes=disabled&destination0=waypoint1;50.118578,8.636551;drop:APPLES,value:30&destination1=waypoint2;50.122540,8.631070;pickup:BANANAS&destination3=waypoint4;50.118654,8.619956;pickup:APPLES&destination4=waypoint5;50.123998,8.640626;drop:PEACHES,value:50&destination5=waypoint6;50.130299,8.613031;pickup:PEACHES&departure=2016-10-14T07:30:00&vehicleCost=0.29&end=waypoint7;50.132540,8.649280&destination2=waypoint3;50.18920,8.629830;drop:BANANAS,value:30&apikey=YOUR_API_KEY
We have reported the issue to API team, ask is to correct/simplify the example.

Related

Image4io and NodeJS: Documentation is clearly outdated. How do I upload an image?

I guess this is as much a call to attention on the fact that the documentation seems to be outright incorrect in its application, as well as just generally lacking. Normally, I would send that part of the message to them personally, but, their contact form is also giving me errors and not sending, so it's not like I have the means to anyway. In the mean time, I'm more worried about getting this code to work, so hopefully someone experienced with this SDK or an Image4io team member sees this and can provide a public answer for others stumbling into this road block.
For starters, I initialized the Image4io object as described in the github here: https://github.com/Image4IO/image4ionodeSDK/
website documentation: https://image4.io/en/documentation/api-sdk/#operation/UploadImage
The image upload example provided on the website's documentation looks like this:
let client=new Image4ioAPI.Image4ioAPI(apiKey,apiSecret);
var request = new Models.UploadImagesRequest("/folderName", true, true);
request.Add("/path/to/image/location/name-of-the-image.jpg", "name-of-the-image", "name-of-the-image.jpg");
let response=client.UploadImage(request);
3 out of the very sparse 4 lines of code they provide give errors. Where did this Models object come from? There is no corresponding class in the import and the code example obviously doesn't show where it was defined. Just what is it and where did it come from?
Well, I found a matching function "UploadImagesRequest" in the original import class, so my guess is Models was deprecated and its functionality was moved into the Image4io class object. If that was the case the solution would be to simply access that function instead... But it's not used the same. It has 4 arguments, the 4th being a "Image4io.UploadFile[]" type. This type has no use examples in the documentation or further details describing what it is exactly. I assume image byte data goes in there somehow, but how?
Finally we have request.Add... except we don't because that isn't a function :( it looks like this was used to actually get the image data (maybe of the type UploadFile?) based on the path of the image. If this function is gone now, how do get file data for use in the upload request function?
Any and all help in figuring out this SDK would be greatly appreciated. Google searches yielded no meaningful results, so hopefully we can help in that department as well. For all I know I just got the wrong version somehow. I guess I could try downgrading to a version that matches the documentation but... that's not a fix in my eyes at all.
Let me know if there's any more info I could provide to help
You can upload image like this:
var client=new Image4ioClient(API_KEY,API_SECRET);
var files=Array();
files.push(new UploadFile("./test.jpg","test.jpg"));
client.UploadImage(new UploadImagesRequest("/",true,false,files))
.then(res=>console.log(res))
If you have binary data at hand, you can write it to a temporary file and then upload them.

A clarification on Google Firestore query pagination

I am currently struggling in understanding how to paginate a firestore collection.
Say I have a collection with 10 docs and I have stored doc5 in my vue.js-based app.
If I wanted to fetch doc6 and doc7, I would issue the following pseudo-command:
query.startAt(doc5).limit(2).get().then(snapshot => ...)
What If I wanted to go two docs backwards relative to doc5? My first guess was to issue the following pseudo-command:
query.endBefore(doc5).limit(2).get().then(snapshot => ...)
Unfortunately, my guess is not correct. I actually obtain doc1 and doc2. This thing is driving me nuts. It is quite evident that I didn't understand the logic behind endBefore(). I did read the firebase docs but couldn't find any light.
May I ask for your merciful help?
If needed, I can provide more context... I am trying to isolate the issue and be as clear as possible.

XPages: How to fetch documents in view and read values?

I am a beginner with XPages, and I have looked at the TLCC Intro free training. I have also seen tutorials here. I have no experience with Lotus Notes, XPages or flat-structured databases. But, I do have some experience in JavaScript and good experience (IMO) in Java and Android.
I am facing the following problems.
1) I am trying to implement a very basic login mechanism.
Currently, I add users manually, based on a form. Now, I want to create a login page. I take a user and a password, and click on a button.
In the button, I want to read all documents associated with a view (that displays all usernames/passwords), compare with entered value, and if it exists check if the password fields match too.
Can someone please guide me in the correct direction? I can't figure out which functions to use. Also, should I be using Scope Variables? Is there a good document/tutorial regarding that?
I have tried the "view.getAllEntries()" method but it always returns null.
Am I approaching this correctly? Are there in-depth tutorials that can help me with this?
2) What is the method to debug SSJS? I am currently putting everything in a try/catch and printing the error there.
I apologize if this question has been asked elsewhere, I haven't really found anything regarding this. Please point me if there is this is a duplicate.
1.
Use view.getDocumentByKey(theUserName) to find a user document in your view. It returns the user document as NotesDocument or null if user is not in view. The view has to have a first sorted column with the usernamens.
2.
As of Notes Domino version 9 you can debug SSJS.

SugarCRM: Putting a image data type in 'Cases' module

I use SugarCRM CE. I'm trying to create an image data type on the Cases module. The purpose of this is so that the employees of my company can attach images that can better explain the cases that they submit. However, I seem to have a hard time implementing this.
I tried to follow the guide at: https://www.atcoresystems.com/blog/adding-a-photo-to-a-contact-record
This apparently does not work for me as when I navigate to the detail view and the edit view of the record, it displays a mess of code instead of the expected output.
On my own, I also tried creating a custom field trying to emulate the 'file' data type of the "Documents" module and using a javascript to display it on the Detail View but no luck at all.
I am able to display something similar to the browse file on the "Documents" Edit View but as soon as I save it, it doesn't show.
Also to include in my worries, even after I successfully use it to accept files and display them, how do I filter them to accept only image files?
Please help!!!
Finally solved this question last Friday and I thought I'd share what worked for me. I revisited https://www.atcoresystems.com/blog/adding-a-photo-to-a-contact-record and decided to give it another shot. However, on Section 4.2, I changed this:
elseif($_FILES[$this->field_name]['size']
to this:
elseif($_FILES[$field_name]['size']
I cleared the cache but mostly what really grounded me was that even after doing so, I still got the same results. So to solve this, I modified my search query and picked other random records to edit. Problem solved!

Sharepoint - How to: dynamic Url for Note on Noteboard

I'm quite new to SharePoint (about 1 week into it actually) and I'm attempting to mirror certain functionality that my company has with other products. Currently I'm working on how to duplicate the tasking environment in Box.com. Essentially it's just an email link that goes to a webpage where users can view an image and comments related to that image side by side.
I can dynamically load the image based on url parameters using just Javascript so that part is not a problem. As far as the comments part goes I've been trying to use a Noteboard WebPart, and then my desire is to have the "Url for Note" property to change dependent on the same URL parameter. I've looked over the Javascript Object Model and Class Library on MSDN but the hierarchy seems to stop at WebPart so I'm not finding anything that will allow me to update the Url for Note property.
I've read comments saying that there's a lot of exploration involved with this so I've tried the following:
-loading the javascript files into VisualStudio to use intellisense for looking up functions and properties in the SP.js files.
-console.log() on: WebPartDefinitionCollection, WebPartDefinition, WebPart, and methods .get_objectData(), get_properties() on all the previous
-embedding script in the "Builder" on the Url for Note property (where it says "click to use Builder" - I'm still not sure what more this offers than just a bigger textbox to put in the URL path)
I'm certain I've missed something obvious here but am gaining information very slowly now that I've exhausted the usual suspects. I very much appreciate any more resources or information anyone has and am willing to accept that I may be approaching this incorrectly if someone has accomplished this before.
Normally I'd keep going through whatever info I could find but I'm currently on a trial period and start school back up again soon so I won't have as much time with it. Apologies if this seems impatient, I'm just not sure where else to look at the moment.
Did you check out the API libraries like SPServices or SharepointPlus? They could help you doing what you want...
For example with SharepointPlus you could:
Create a Sharepoint List with a "Note" column and whatever you need to record
When the user goes to the page with the image you just show a TEXTAREA input with a SAVE button
When the user hits the SAVE button it will save the Note to the related list using $SP().list("Your list").add()
And you can easily retrieve the information (to show them to the user if he goes back to the page) with $SP().list("Your list").get()
If I understood your problem, that way it may be easier for you to deal with a customized page :-)

Categories

Resources