Check out our High Performance Batch Processing API: Match and Enrich Data Using CSV/TSV Files as Input Data to our APIs Learn More

Invoking APIs from the Command Line using cURL

by Interzoid Team


Posted on August 20th, 2019


Use CURL to Invoke APIs Quickly and Easily to Understand Value and Build Applications

cUrl, which stands for "client URL", is a command-line utility for sending and receiving data. It works with a wide range of protocols including http, https, and ftp. This makes it an ideal tool for executing and testing APIs without having to write any code, enabling a potential API consumer to get comfortable with a given API and easily discover and understand its behavior and value without a significant time investment. And while its beauty is in its simplicity, it can also be used in advanced ways such as enabling proxy support, performing FTP uploads, HTTP post commands, multiple forms of user authentication, and a whole lot more.

The tool works from the Command Line in most flavors of Linux, the Command Prompt in Windows, the Terminal in MacOS X, and other implementations of a Unix shell command line such as Bash.

To ensure that you have it installed on your machine, go to the command line and enter the following:

$ curl --version

In the unlikely event you don't already have it installed, get it from here.

For detailed usage information, you can read the documentation by entering the following:

$ curl --man

or in Windows:

> curl --help

For now however, let's keep things simple and execute some APIs from the command line. In these examples we will be using various APIs from Interzoid. You will need an API key from Interzoid, which only requires your email address to register and obtain one. Use your own API key when you see YOURAPIKEY in the code.

Note in the examples below, we will be using single quotes around the URL in the cURL API calls. This is a requirement for APIs with multiple parameters. In the case of Windows, you must use double quotes around the URL.

In this example, we will be obtaining a real-time currency quote from Interzoid's Get Currency Rate API. Simply enter the following from the command-line:

$ curl 'https://api.interzoid.com/getcurrencyrate?license=YOURAPIKEY&symbol=EUR'

or in Windows (this is the only time we will show the Windows variant syntax):

> curl "https://api.interzoid.com/getcurrencyrate?license=YOURAPIKEY&symbol=EUR"

And here is the JSON data retrieved and returned from the API:

{"Symbol":"EUR","Name":"Euro","Country":"European Union","Rate":"0.895","Code":"Success","Credits":"72250"}

In this example, we will perform a currency conversion using the Convert Currency API:

$ curl 'https://api.interzoid.com/convertcurrency?license=YOURAPIKEY&from=eur&to=usd&amount=10'

JSON data in response:

{"Converted":"11.30","Currency":"USD","Code":"Success","Credits":"93244"}

Here is an example of the Get Weather by Zip Code API:

$ curl 'https://api.interzoid.com/getweatherzipcode?license=YOURAPIKEY&zip=43210'

And the response:

{"City":"Columbus","State":"OH","TempF":"84.0","TempC":"28.9","Weather":"Fair","WindMPH":"11.5","WindDir":"South","RelativeHumidity":"63","VisibilityMiles":"10.00","Code":"Success","Credits":"18005"}

As you can see, cURL is an easy way to take any API for a test drive before putting it to use.


High-Performance Batch Processing: Call our APIs with Text Files as Input.
Perform bulk data enrichment using CSV or TSV files.
More...
Available in the AWS Marketplace.
Optionally add usage billing to your AWS account.
More...
See our Snowflake Native Application. Achieve Data Quality built-in to SQL statements.
Identify inconsistent and duplicate data quickly and easily in data tables and files.
More...
Connect Directly to Cloud SQL Databases and Perform Data Quality Analysis
Achieve better, more consistent, more usable data.
More...
Try our Pay-as-you-Go Option
Start increasing the usability and value of your data - start small and grow with success.
More...
Free Trial Usage Credits
Register for an Interzoid API account and receive free usage credits. Improve the value and usability of your strategic data assets now.
Automate API Integration into Cloud Databases
Run live data quality exception and enhancement reports on major Cloud Data Platforms direct from your browser.
More...
Check out our full list of AI-powered APIs
Easily integrate better data everywhere.
More...
Business Case: Cloud APIs and Cloud Databases
See the business case for API-driven data enhancement - directly within your important datasets
More...
Documentation and Overview
See our documentation site.
More...
Product Newsletter
Receive Interzoid product and technology updates.
More...