web services - cURL command for HTTP GET -


i have web service contains method dowork(). method used retrieve data database , pass data caller in json format.

    [operationcontract]     [webinvoke(method = "get", uritemplate = "dowork")]     public stream dowork()     {         return new memorystream(encoding.utf8.getbytes("<html><body>work done</body></html>"));     } 

i have composed fiddler request verify method available.

enter image description here

if execute fiddler, method in web service gets called. can't seem figure out how construct curl command same thing.

perhaps easiest approach having chrome create curl command line you, when request involves many headers , complicated post data.

open developer tools pressing f12 , going network. run whatever call want monitor. (in example can see happens when open questions here on stack overflow)

enter image description here

then right click on relevant line , select copy curl (cmd) if on windows (for linux use other)

enter image description here

this give command line similar this:

curl "http://stackoverflow.com/questions" -h "accept-encoding: gzip, deflate, sdch" -h "accept-language: de-de,de;q=0.8,en-us;q=0.6,en;q=0.4" -h "upgrade-insecure-requests: 1" -h "user-agent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, gecko) chrome/47.0.2526.106 safari/537.36" -h "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" -h "referer: ..." -h "cookie: ..." -h "connection: keep-alive" --compressed 

if experience problems should add -v see more details, detailled explanation of commands can see manual. perhaps need add existing curl command line browser specific headers (user-agent, accept, ...)


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -