- How to install curl on windows
- How to install CURL on Windows 10
- Install CURL on Windows 10
- 1] Install Git for Windows
- 2] Download, and Install Curl from the source website
- 3] CURL installer
- Installing and using cURL
- Using cURL
- Using cURL in Windows
- Replace line-ending backslashes
- Move JSON data to a file
- Installing cURL
- macOS
- Windows 10, version 1803 or later
- Windows
- Testing your cURL installation
- Common cURL flags
How to install curl on windows
This tutorial shows you how to access Oracle Messaging Cloud Service via the REST interface by using the cURL command-line tool. cURL is free, open software that runs under various operating systems.
This tutorial demonstrates cURL on a Windows 64-bit operating system that is enabled for the secure sockets layer (SSL). The authentication aspects of the Messaging Cloud Service require an SSL-enabled environment.
Your first task is to install the appropriate version of cURL for your SSL-enabled environment.
There is an ordered series of steps to follow to install cURL on Windows. There are two libraries to install and they must be installed before cURL will work with SSL. Also, they must be installed in this order to work. Do not skip the step to install a recent certificate.
Install Visual C++ 2008 Redistributable Package.
For 32-bit systems: Visual C++ 2008 Redistributables (x32)
Install Visual C++ 2010 Redistributable Package.
For 32-bit systems: Visual C++ 2010 Redistributables (x32)
For 64-bit systems: Win64 OpenSSL v1.0.0k Light
For 32-bit systems: Win32 OpenSSL v1.0.0k Light
In your browser, navigate to the cURL welcome page at http://curl.haxx.se and click Download.
On the cURL Releases and Downloads page, click the link for the SSL-enabled version for your computer’s operating system, download the zip file, and install it in a new folder on your computer.
The cURL website offers a wizard to find the appropriate version for your computer’s operating system.
For this tutorial, the 64-bit generic, SSL-enabled version for Windows is selected.
Install recent CA Certificates. Do not skip this step.
Download cacert.pem , a recent copy of valid CERT files, from http://curl.haxx.se/docs/caextract.html.
Copy it to the same folder where you placed curl.exe and rename it curl-ca-bundle.crt .
Invoke curl.exe from a command window (in Windows, click Start > Run and then enter «cmd» in the Run dialog box).
You can enter curl —help to see a list of cURL commands.
To navigate this Oracle by Example tutorial, note the following:
Hide Header Buttons: Click the title to hide the buttons in the header. To show the buttons again, click the title again. Topic List: Click a topic to navigate to that section. Expand All Topics: Click the button to show or hide the details for the sections. By default, all topics are collapsed. Hide All Images: Click the button to show or hide the screenshots. By default, all images are displayed. Print: Click the button to print the content. The content that is currently displayed or hidden is printed.
To navigate to a particular section in this tutorial, select the topic from the list.
How to install CURL on Windows 10
CURL is a command-line tool and library for transferring data with URLs. It is free, and many applications use it. In this post, we will share how you can install CURL on Windows. It is somewhat surprising that it is used in cars, television sets, routers, printers, audio equipment, mobile phones, tablets, set-top boxes, media players and many more places.
Install CURL on Windows 10
Starting with Windows 10 v 1803, the OS now ships with a copy of CURL. It is already set up, and you can start using it right away. Open the command prompt, and type “curl -help“. If there are no errors, and displays all the options of curl, it’s installed on your Windows 10.
Along with Curl, Microsoft also rolled out Tar, a command-line tool to extract files and create archives.
If for some reason you do not find CURL installed on your Windows OS, here is how to install Curl on Windows.
Read: How to zip and unzip files in Windows 10 using the built-in feature.
1] Install Git for Windows
Download Git for Windows, and it will install CURL along with it. You can find it installed under C:\Program Files\Git\mingw64\bin\. Add it to your Windows path, and you will be able to execute it from anywhere.
Press the start button, and type system path . It will display an option to edit System Variables. Click on Environmental Variables, and you will be able to add the path as mentioned above into the system path.
2] Download, and Install Curl from the source website
If Git is not something you want, you can install CURL from the source website. Go here, and download the appropriate one for your system (32 or 64 bit). If you want to download specific packages, visit the curl packages page. Here you can download either the curl executable, libcurl development, libcurl, or the source code. Make sure to add the executable to your path.
3] CURL installer
If you prefer a 1-click installer, use cURL for Windows. You can download it here.
All these will install CURL on Windows. If you are developing something or it’s your application that needs CURL to work on your computer, it has you covered.
Installing and using cURL
All the examples in the Zendesk REST API docs use cURL, a lightweight, command-line tool for making HTTP requests without a web browser. cURL lets you try out various API requests in a command-line interface such as the command prompt in Windows or Terminal in macOS. You don’t need to build a working web application just to try out the APIs.
cURL makes HTTP requests just like a web browser. To request a web page from the command line, type curl followed by the site’s URL:
The web server’s response is displayed directly in your command-line interface. If you requested an HTML page, you get the page source — which is what a browser normally sees.
This article covers the following topics:
Using cURL
You can use cURL to inspect and test different Zendesk API requests without having to build a functioning web application. For example, the following cURL statement makes an HTTP request to the List Groups endpoint in the Zendesk API:
The API returns a JSON object that lists the groups in your Zendesk Support instance:
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It’s designed to be easy for humans to read and write, and for machines to parse and generate. To learn more, see Working with JSON.
Using cURL in Windows
You can use the Windows command prompt to run the cURL examples. To start the command prompt, open the Start menu, type cmd in the search box, and press Enter.
cURL isn’t installed in Windows by default. See Installing cURL below to install it on your system.
The examples in the docs have to be modified slightly to work correctly in Windows. First, replace any line-ending backslash (\) character with the caret (^) character. Second, if an example contains JSON data, move the data to a file before running the example. The following sections give more details.
Replace line-ending backslashes
The cURL examples often have a backslash (\) at the end of lines to break up a long statement into easier-to-read lines. The backslash is a line continuation character in UNIX but not in Windows. In Windows, replace any backslash at the end of lines with the caret (^) character, which is an escape character in Windows. Don’t leave any space after any ^ character or it won’t work. The caret will escape the space instead of the new line.
You can paste a multiline statement at the command prompt by clicking the icon in the upper-left corner and selecting Edit > Paste. If you prefer using the keyboard, press Alt+spacebar to open the menu, then press E and P.
Move JSON data to a file
The Windows command prompt doesn’t support single quotes. It’s a problem because cURL statements use single quotes to specify JSON data. Example:
The statement specifies JSON data for creating a group (the -d flag stands for data). Because the JSON is enclosed in single quotes, the statement won’t work on the command line.
To fix the problem, save the JSON in a separate file and import it into the cURL statement. To modify the example above, create a file named json.txt containing the following text:
Next, change the cURL statement to import the JSON data with the @filename syntax:
Before running the statement, use the cd command (for change directory) to navigate to the folder that contains the file. Example:
C:\> cd json_files
Then paste the cURL statement at the command prompt:
An alternative to moving the JSON to a separate file is to use double quotes around the JSON data in the cURL statement and escape the inner ones with backslashes:
It doesn’t end there. The following special characters in strings must be escaped with the caret (^) character: &, \, , ^, | . If the JSON includes HTML, such as when you try to create or update an article in Help Center, you need to find and escape all the angle brackets in the HTML.
This is tedious and error prone. Best to stick with importing the JSON from a file.
Installing cURL
macOS
cURL is installed by default on macOS. To try it out, see Testing your cURL installation below.
Windows 10, version 1803 or later
If you have version 1803 or later of Windows 10, cURL is installed by default. To try it out, see Testing your cURL installation below.
Windows
If you have a version of Windows earlier than Windows 10, version 1803, you can download and install cURL as follows.
In Windows, create a new folder called curl in your C: drive.
Go to http://curl.haxx.se/download.html and download one of the following zip files:
- If you have a Windows 64 system, scroll to the Win64 — Generic section and look for the latest Win64 ia64 zip version with SSL support. It’s normally second in the list. Click the version number to start the download.
- If you have a Windows 32 system, scroll to the Win32 — Generic section and look for the latest Win32 zip version with SSL support. It’s normally second in the list. Click the version number to start the download.
Unzip the downloaded file and move the curl.exe file to your C:\curl folder.
Go to http://curl.haxx.se/docs/caextract.html and download the digital certificate file named cacert.pem.
The PEM file contains a bundle of valid digital certificates. The certificates are used to verify the authenticity of secure websites. They’re distributed by certificate authority (CA) companies such as GlobalSign and VeriSign. The PEM file allows cURL to connect securely to the Zendesk API using the Secure Sockets Layer (SSL) protocol.
Move the cacert.pem file to your C:\curl folder and rename it curl-ca-bundle.crt.
Add the curl folder path to your Windows PATH environment variable so that the curl command is available from any location at the command prompt. Update the variable as follows:
In the Start menu, right-click This PC and select More > Properties.
Note: In Windows 7, right-click Computer and select Properties.
Click Advanced System Settings.
In the Advanced tab, click the Environment Variables button on the lower right side.
Select the «Path» variable in System Variables, and click Edit.
In the Edit environment variable dialog box, click New and add the path to the curl.exe file. Example: C:\curl.
Windows 7: In the Variable Value textbox, append a semicolon to the value, followed by the path to the curl.exe file. Example: ;C:\curl
Keep clicking OK to accept the change and close the dialog box.
Testing your cURL installation
You can test your cURL installation by making a request to the Zendesk API. The test retrieves your Zendesk Support user information.
To test cURL
Paste the following cURL statement into your favorite text editor:
For details on this endpoint, see Show the Currently Authenticated User in the Zendesk API docs.
Replace the placeholders in curly brackets with the information you use to sign in to Zendesk Support. Example:
Launch your command-line interface.
- In Windows, open the Start menu, type cmd in the search box, and press Enter.
- In macOS, double-click the Terminal application in your Applications/Utilities folder.
Copy the cURL statement from your text file and paste it at the command prompt.
Windows users: After copying it to the Clipboard, select Edit > Paste from the context menu in the upper left corner of the window:
Press Enter to run the cURL statement.
The console should display your Zendesk Support user information formatted as a JSON object.
You can pretty print the results to make it easier to read. See Converting JSON to data you can understand.
Common cURL flags
You’ll see the following cURL flags in the examples in the Zendesk REST API docs.
-H
Specifies any extra header content to include in the HTTP request. API requests that submit data to our servers typically include the data’s content type. Example:
Example: -H «Content-Type: application/json» .
-u
Specifies the user name and password to use for server authentication. The user name and password are separated by a colon.
Example: -u myemail@example.com:mypassword
-v
Makes the response more verbose.
-X
Specifies the request method to use when communicating with the HTTP server. Example: PUT or POST .
-G —data-urlencode
Used for API endpoints that send data in a query string, such as the Search API. The —data-urlencode option url-encodes the query string. The -G flag specifies that the url-encoded data is for a GET request rather than a POST request.
For example, suppose you want to run the following search using the List Search Results endpoint: