I’m trying to convert a cURL string into lucee…

curl -H "X-Auth-Key: $key" \
    -H "X-Auth-Workspace: $workspace" \
    -H "X-Auth-Signature: $signature" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -X GET

How would you convert this into cfhttp + cfhttpparam?
I’ve not been able to find a method of looking at the headers that are being sent. I know the cURL works!


Here’s one way - not necessarily the best:

  1. Create a dummy local endpoint to echo the http data, e.g. a template called “httpResonse.cfm”, containing just:
dump( var=getHTTPRequestData(), format="simple" );
  1. Call that endpoint using cfhttp and dump the result:
http method="get" url=targetUri result="result" {
	httpparam type="header" name="X-Auth-Key" value="#key#";
	httpparam type="header" name="X-Auth-Workspace" value="#workspace#";
	httpparam type="header" name="X-Auth-Signature" value="#signature#";
	httpparam type="header" name="Content-Type" value="application/json";
	httpparam type="header" name="Accept" value="application/json";
echo( "<pre>#result.fileContent#</pre>" );

Thanks - Very useful. I was only able to find a post one…

Everything looks ok with the results, but it still does not work!

I wonder if the X-AUTH etc is case sensitive… Its coming through in lowercase.

curl -X GET ''

This is the actual curl command, redacted.

Everything using the echo http data looks correct but when activated from Lucee does not work. I know the curl command works so there must be something in the actual string sent to the remote that causes the error!

Does anybody know of a method to see the actual string that is sent?

Why is this so difficult? Here we are, API’s on the way out in favour of gRPC and protocol buffers/flatbuffers and we still can’t get a simple API call to work.

I have spent hours on this and got absolutely nowhere…

Another trick I learned from @isapir is to add some JVM arguments so that the details of http calls are included in your servlet container’s (e.g. Tomcat) error logs:

1 Like

Thanks Julian

Could you help me on where to put these please…

Do they go in CATALINA_OPTS?

It’ll depend on your environment. I run Tomcat/Lucee as a Windows service, so the jvm args are controlled via a service control applet. For other Tomcat setups I think CATALINA_OPTS will probably be the right place.

1 Like

this would be a lot easier to debug if you could set a proxy for http, please vote for the issue

allow to set a general Proxy in the admin

Done the vote - I’m now looking at the logging on Google App Engine using fluentd to identify the java logging for http requests…

I used Wireshark and some Java logging. In the end I sorted out the problem - it wasn’t Lucee. The instructions from the API provider were not clear.

However, it would be good to see the actual string sent down the wire before encryption.

I can see why API’s are not good!

gRPC gets around this problem with a .proto file and the connection is built from there. Google start 10 Billion API calls per second using gRPC…

Thanks for your help Guys…