Curl Post



If you use -d in the request, curl automatically specifies a POST method. With GET requests, including the HTTP method is optional, because GET is the default method. HTTP post This tool also supports the use of all the following protocols: DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, and TFTP. This guide will outline a few popular curl examples, along with a description of what each command does.

Client for URLs (or cURL) is a software project comprised of two development efforts - cURL and libcurl.

When curl follows a redirect and if the request is a POST, it will do the following request with a GET if the HTTP response was 301, 302, or 303. If the response code was any other 3xx code, curl will re-send the following request using the same unmodified method. I'm making a curl request where it displays an html output in the console like this Warning: Cannot modify header information - headers already sent by (output started at /home/. I use Ubuntu and installed cURL on it. I want to test my Spring REST application with cURL. I wrote my POST code at the Java side. However, I want to test it with cURL. I am trying to post a JSON d.

libcurl is a free, client-side URL transfer library with support for a wide range of protocols. libcurl is portable, thread-safe, feature rich, and well supported on virtually any platform. It is probably the most popular C-based, multi-platform file transfer library in use.

cURL is a command-line tool for getting or sending files using URL syntax. Since cURL uses libcurl, it supports the same range of common Internet protocols that libcurl does.

This tutorial will walk through the format and syntax used when making Oracle Eloqua API requests with cURL. If you are not yet familiar with the structure of requests, see API requests.

In this tutorial:

Note: The code samples in this tutorial are developed for bash. See cURL request formatting for more information on how to structure cURL requests for other command line tools.

Authentication

The easiest way to authenticate with Oracle Eloqua's APIs is to use basic authentication which uses your Eloqua company name, user name, and password to authenticate. To use basic authentication, use the cURL --user option followed by your company name and user name as the value. cURL will then prompt you for your password.

To avoid the password prompt, append your password after your user name by following the syntax --user '<companyName><userName>:<password>', but this will leave your password in shell history and isn't recommended.

Note: For this tutorial, the company name we use is APITest, our user name is API.User, and our pod is 3.

Sending a GET request

Let's retrieve the first two contacts within your database. Only the --user option is required. The --request option is optional, but we include it in the example below for conformity with other requests to establish a pattern.

Post

Curl Post Example

Sending a DELETE request

For DELETE requests, the --user option and --request option are both required. Let's delete a contact whose contact id is 1.

Note that for DELETE requests, there is no body is returned, just a response status code.

Sending a POST request

Curl Post

Curl Post Body

POST requests are a little different. Let's look at an example of how to create a contact whose email address is 'george.washington@america.com'.

As you can see POST requests are much different than the other verbs we've looked at so far, so let's take a closer look at what's happening in the request.

Post
  • The --header option is required with a Content-Type. All POST and PUT requests to the Application and Cloud APIs should be application/json, while the Bulk API supports application/json and text/csv. To confirm the media types supported, see the 'Supported Media Types' per endpoint in our endpoint documentation.
  • The --data option is optional, but we include it for readability.

Sending a PUT request

PUT requests follow the same format as POST requests. Let's take a look at an example of how to update a contact to change the contact's business phone number when the contact id is 1 and email address is 'george.washington@america.com'.

Learn more