HTTP request error from running Postman Collection tests with Newman? - json

I've been using the new commandline for Postman, Newman, and have been attempting to run Collection tests that work fine when I pass them through the packaged app Jetpacks add-on, but do not run properly in the commandline. Although the json Collection file that I am passing does contain the proper header declarations, I don't have any other clues at this point, so I suspect that this may be an HTTP header issue. But I am not sure exactly what is wrong, as I am rather new to using Postman.
The tests that I'm trying to run are on some calls to an ASP.Net web API, very simple server response-checking one-line javascript tests like the ones in this tutorial.
A sample line that I enter into the console:
$ newman -c collectionfile.json -e environmentfile.json -n 5
achieves such a result:
RequestError: [token] terminated. Error: undefined
Any suggestions/help would be appreciated.

I ran into this problem as well and spent quite a few hours trying to figure it out. Eventually I realized that an address such as "www.google.com" will work in the chrome plugin UI, but not in Newman. For it to work in Newman, the address must be "https://www.google.com". Also, make sure that you have your data file (if you are using variables like {{url}}) set up correctly. You can use "-d dataFile.json" to define a data file. More information on that here.

Related

Set POST parameters correctly in an HTTP Retriever node

I want to hit a remote API using a post request. It's working fine with Python, but when it comes to my Knime workflow, the remote end is complaining that it can't find a needed parameter (type in the image below). What is the correct way to pass the post parameters in Knime? In Postman I would have a body tab for example to define everything I needed, but apparently I'm missing something in Knime.

Setting http get command as source in SpringXD

This command executed in SpringXD shell
http get --target https://webserviceaddress
gives me JSON document.
Is anybody has idea how to create stream with this as source ?
I see way to make just custom module, but maybe I missed somehow simpler solution ...
The http "command" is a convenience command in the XD shell, so that you don't have to use curl or any external command. It just makes a one-off http request to some endpoint (the default address being http://localhost:9000 which happens to be where the http source module would listen -- again, this is for convenience).
If you want to create a stream, then you need a module that is able to make http requests to a remote endpoint. The http-client processor module does just that. It needs to be triggered by some external source, e.g. the trigger module.
See http://docs.spring.io/spring-xd/docs/current-SNAPSHOT/reference/html/#http-client
To use webservice with get method as source I need trigger as source and http-client as following module for example below stream will get content from webservice every 60 seconds and write it to file
stream create --name stream_name --definition "trigger --fixedDelay=60 | http-client --url='''https://webservice.url''' --httpMethod=GET | file" --deploy

Unable to get accurate results from Browserlocation API with curl

I'm trying to get the current location of my computer from Google's BrowserLocation API.
How to create a script to query Google Browserlocation: This thread helped me construct the script, but one problem remains: the accuracy is way off when using curl from the command line: "accuracy" : 11178. Bafflingly, if I copy-paste the same address in my browser, the returned JSON is perfectly fine with an accuracy of "accuracy" : 52.
What could the crucial difference be, and how do I modify the curl script to work like my browsers do? There is JSON, CURL and Google's geolocation this previous thread with what appears to be a similar issue, but the solution posted does not help me.
I have Wireshark, and a capture of the two methods of accessing the API. I am currently trying to figure out how to retrieve the relevant packets for inspection. If anyone can help me with this intermediate step, that would be most welcome.
Well I got it to work. The issue was that I didn't URL escape the names of the access points. Look here for how to do this with Perl.

jsFiddle how to get json?

Hy,
I'm working on a jsFiddle with a openlayers example in it.
http://dev.openlayers.org/releases/OpenLayers-2.11/examples/snapping.html
At the moment it's not working because it's not getting a response for the http request to get data. How do I fix that?
The jsFiddle is here: http://jsfiddle.net/TcuxA/6/
Go to the line "// create three vector layers" in the script.
There are 3 requests for data. If you type the URLs in your browser you get the JSON, but my firebug gives 3 errors when I run the jsFiddle.
I tried fixing with jsFiddle echo ( http://doc.jsfiddle.net/use/echo.html ), but that didn't work. I don't know how to change the script to load the data otherwise.
Why can't I get the json by these URLs? What are good sollutions?
What you are experiencing is an exception being thrown by the XMLHttpRequest object, because you are using AJAX to call elements from different domain. This is better said, for example, in here:
"The XMLHttpRequest object is prevented from calling web services from outside its own domain. This is sensible given that if you called a script in one place and it, in turn, called a script on another server, it could leave an application open to all sorts of malicious scripts, hacks and exploits."
So the easiest way to do is to code it locally and call a local copy of the files (poly.json, line.json and point.json) that would reside on your local server. For testing if all displays on a map you could hard-code the files into your code. I am not sure how it could be achieved otherwise.
A good solution can be this : using github responses . You can store your example in github, along with the predefined XHR requests responses.

wcftestclient.exe 'has stopped working'

When using the WCF Test Client tool, if I invoke a method via eager loading like below:
.Include("entity name")
the client tool crashes with a "stackoverflow" exception.
If I make a call without the Include statement, it works fine.
Note that either way, if I execute them via another type of client, I can see in the WCF trace message log, that the data gets xferred just fine for both. It's just that the WCF client tool can't seem to handle calls via EnityFramework and eager loading when data from more than one entity is brought back.
I guess there is not a way around this error with this tool. Looks like I have to resort to testing with my other client making the call instead of simply invoking the method via the WCF test client tool.
Anyone see this same scenario. If so and if there is a work around, I'd appreciate it if you could let me know.