LiquidFiles Documentation
LiquidFiles Documentation

Debugging Tools

Curl, that we provide examples with, is an excellent development tool to test thing like API's with various things as it's very easy to tweak everything from Content-Type to authentication and everything else. But, curl may not be something that you're likely to use for an actual intagration into your environment although there's absolutely no problem in doing so. The LiquidFiles Unix/Linux/Mac OS CLI application is using libcurl, the library version of curl to do the actual data transfer.

Another very handy tool for development of API integrations is a web development http/https proxy to really see what's going on and being able to debug and troubleshoot your own implementation. In this example we're going to use Charles Proxy but you can use any Web Development Proxy to do this.

What a web development proxy enables you to do is to intercept the connection between your own development platform and the server you're trying to integrate with.

Charles Proxy that we're using in this example listens on default on port 8888, and you also need to configure the SSL proxy component. This can be configured in Proxy → SSL Proxy, and you need to add the sites you wish to use the SSL proxy for. In the following screenshot you can see that Charles Proxy has been configured for our development site at https://172.16.5.131.

After the proxy has been configured, we need to make sure that our test/development system uses the proxy, so we can get the benefit of seeing what's being transmitted. Using curl, this can be achieved by adding -x proxy_url. You will also need to add -k to turn off certificate validation. A complete example would be:

curl -k -x http://localhost:8888 -X GET \
     --user gUpGizj6g8CtFB1cGAH3mM:x \
     -H "Accept: application/json" \
     -H "Content-Type: application/json" 
     https://172.16.5.131/account

And that looks like the following in Charles Proxy. As you can see, there's the URL, Content-Type, Authentication header and the body in the lower part. In the other tabs you can see even more information.

Where this then becomes important is that you now have a known baseline. By using the curl examples in these development pages, you can compare how your own code sends the requests to the LiquidFiles server since everything is captured by the development proxy when you're sending the requests from your own implementation.

Another alternative to using a Web Development Proxy is to use something like Wireshark. Wireshark intercepts traffic on the network interface so there's no need to configure a proxy. But since traffic is often encrypted using https, you will need to switch to using http for development if you choose to use Wireshark instead of a Web Development Proxy.