1

A bit of background information: I'd been a Java developer for a company for about 6 years. This company used a variety of Linux-based operating systems for its day-to-day operations; all of our servers and development machines were some variant of Linux. When we were developing new web-services and wanted to discuss usage or bugs within them, it was customary for one developer to ask the other for the cURL syntax of the request in question. E.G.,

Developer A: How should I interpret the data from endpoint 'foo/bar'?

Developer B: Can you send me the cURL for what you're trying to do?

Developer A: Sure.

And then Developer A would attach something like this:

$ curl -i -X POST -H 'Content-Type: application/json' http://some-host.org/foo/bar -d '{"baz": "qux"}'

This served well for communicating HTTP test cases and such between engineers. In general, it perfectly describes how the HTTP request is going to come out looking.

However, about a year ago, my company was bought up by another company, and now the parent company is trying to integrate with about 10-million lines of my former company's code. But there are some problems... One problem we've had is that the company that purchased my former company is largely Windows-Only. Pretty much everything is done using Windows and Microsoft technologies, not Linux.

This leads to communication problems on a regular basis. When someone tells me that something in our linux servers "doesn't work," my first reflex is to ask for the cURL statement that represents their HTTP request. But... well, the majority of my new colleagues seem to not know what cURL is, because I guess Windows doesn't have cURL (I'm not much of a Windows guy so correct me if I'm wrong on that!).

So I'm wondering, is there a better, more-ubiquitous, cross-platform way for us to communicate HTTP requests between each other?

  • 2
    "I guess Windows doesn't have cURL" - something wrong with Google so you need to guess? As with almost any Unix/Linux command line tool, you can simply install it on Windows. Moreover, you can always ask "can you send me the http request" instead of "send me the cURL." – Doc Brown Sep 20 '16 at 20:11
  • 3
    The problem is not that you can't install curl, its that windows developers typically don't think / work that way, causing a communication barrier – Michael Shaw Sep 20 '16 at 20:13
  • 1
    Maybe I'm missing something here, but can't you just ask for the URL and JSON being posted? Thats about all a cURL request is. – GrandmasterB Sep 20 '16 at 20:16
  • Powershell is a cross-platform way to communicate HTTP requests, see superuser.com/questions/362152/… and github.com/PowerShell/PowerShell. It is as cross-platform as cURL, preinstalled on Windows but has to be installed additonally on Linux. – Doc Brown Sep 20 '16 at 20:20
  • 1
    @nasukkin just because it doesn't come prepackaged doesn't mean it isn't available. There is a Windows version of cURL. I tend to use Telerik Fiddler myself. Others use postman. – RubberDuck Sep 20 '16 at 22:51
9

Is there an industry standard?

You betchya. It's the actual Http protocol. An actual Http Request looks something like this.

POST /cgi-bin/process.cgi HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)
Host: www.tutorialspoint.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: Keep-Alive

licenseID=string&content=string&/paramsXML=string

Tutorial Point

You could try to teach these guys cURL (and maybe they should learn if they need to work on *nix boxes), but they're likely using a GUI tool like Postman or Telerik Fiddler. These tools will provide the full request. I bet cURL will echo it back too, if you know how to ask for it. I would recommend you learn what cURL is actually sending across the wire. Not only will you all have a common language to speak, but you'll also learn a bit about the technology you're using.

  • I like this answer and in fact tried it, but my coworkers are as opposed to it as cURL. Also, I am familiar with PostMan as a Chrome addon; it's something worth looking into. Maybe my issue isn't a standards issue as much as it is a coworker issue? – nasukkin Sep 20 '16 at 23:14
  • 5
    nasukkin: It definitely sounds like a coworker issue. HTTP requests are what all those tools like cURL, PostMan, or whatever other new-fangled app you like are sending under the hood. It is not possible to talk to a web server without sending an HTTP request. – Jack Sep 21 '16 at 1:43
  • @nasukkin have your new coworkers ever used a webservice before? What do you mean "they're opposed to it as cURL"? – RubberDuck Sep 21 '16 at 9:19
  • 1
    Ah, the good old HyperText Transfer Protocol protocol... – 8bittree Sep 21 '16 at 13:50
2

I would highly recommend taking a look at Postman - while it doesn't look like they have a Linux app just yet, the Chrome app might work out for you.

They have tools built in for working with curl http://blog.getpostman.com/2016/02/03/curl-and-postman-work-wonderfully-together/

0

While not suitable for one-off requests, there are a number of formal ways to unambiguously document a REST API. I believe the most popular is swagger, but also there is blueprint and RAML. If you happen to work in the telecom industry, the industry standard is YANG, because we have to do everything the hard way. If you are running into this problem a lot, it's well worth the effort to go through the documentation process. I've used swagger personally. It has a nice editor to help and a helpful UI for displaying the results. Here's an example from their demo:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.