AZDO Release Pipeline Gate Success Criteria for Rest-API - javascript

I am trying to use the Release Pipeline Gate feature using an Invoke REST API. I am getting the Response successfully, however, I have issues with the success criteria.
The result I am getting from the API Call:
{"projectStatus":{"status":"NONE","conditions":[],"periods":[]}}
Now the issue I am having is with setting up the criteria. If it was per say only {"status":"NONE","conditions":[],"periods":[]} it would've been easy as eq(root['#status'], 'NONE') would've worked, but what can I do in the case above?
I've tried absolutely everything and nothing works. I've followed a lot of examples but I couldn't find an example like this one.
Could you please assist?

After many tests, I managed to find the solution:
eq(jsonpath('$.projectStatus.status')[0],'NONE')
Works flawlessly...

Related

How does ember fetch perform ajax query?

I'm using ember-fetch and from it's source code I cannot figure out where it made the call XHR call.
In another word, where does it call window.XMLHttpRequest?
Coming from a jQuery background, I'm also trying to figure out where can we specify option such as processData = false as seen in here, but this time I want it in ember-fetch-way.
In another word, where does it call window.XMLHttpRequest?
Short answer is: it doesn’t. Its repo says “HTML5 fetch polyfill from github wrapped and bundled for ember-cli users”, so it does what is says on the tin, it uses the Fetch API instead.
(…) I'm also trying to figure out where can we specify option such as processData = false
Right, if I understand this correctly, fetch by default does not process the data it gets, that’s why you see so many examples with something like response.json() (like on the repo you linked).

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.

Here API findpickups example doesn't work

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.

How to search by id in Mockable.io?

I created a mock service using mockable.io.
For example:
Putting this in the url works:
http://demo#####.mockable.io/items
But if I filter it with:
http://demo#####.mockable.io/items?pid=5
It doesn't work as it should, it shows all the data instead of filtering them.
Can anyone tell me what I'm doing wrong please?
Mockable is in beta and I suspect they haven't sorted all the kinks out yet, I have the same problem when using it. An alternative is Sandbox - you can script mock service behaviour and can handle query parameters any way you like (disclaimer: I'm a founder)
I just tested your scenario and it works in my space.
Maybe you inverted the responses between the 2 mocks ?
You should send a support request to the mockable.io team. They are very active and will help you.
I solved it using filter.
Example: /blogs?filter=blog1
Documentation link: https://www.mockapi.io/docs
SEARCHING & FILTERING
Add query params to GET request:
/blogs?search=blog1
/blogs?filter=blog1
/blogs?title=cool%20blog

trying to call functions asynchronously in javascript (with angularjs)

I'm trying to call a function (for TTS) in phonegap that varies in length (i'm reading different news headlines) immediately following each headline, I have a voice recognition function, prompting the user for a voice command. like this...
navigator.tts.speak("If you would like to go to the next article, please say continue. Otherwise, say read me for another section");
$scope.reco();
The reco() calls voice recognition. I cannot get the previous call
navigator.tts.speak(*<news_headline.>*)
to finish before reco() is called. I am using angular, so I've tried using angular's promises ($q) (in a few different ways), but I can't seem to figure out how to get speak() to wait before reco() is called. Any suggestions?
One more dimension: I am using phonegap (almost entirely for android purposes), and in my little experience, it can cause a lot of trouble.
Any help regarding this would be appreciated.
I just checked the documentation for both TTS plugins listed on build.phonegap.com and both have callback functionality.
Try this:
navigator.tts.speak("If you would like to go to the next article, please say continue. Otherwise, say read me for another section",$scope.reco);

Categories

Resources