About the curl command examples

In the curl examples, the workstation is running a Linux-based operating system and curl version 7.35 is installed.

The curl examples generated by the AOS-CX REST API Reference might use different options than in other examples, and do not include cookie file handling because the cookie is handled by the browser.

Many examples of curl commands are formatted in multiple lines for readability. The backslash (\) continuation character at the end of the line indicates that the command continues on the next line.

The curl command examples in this document use minimal options. The following options are commonly used in the curl command examples:

-b <cookie-file>

Specifies that the file <cookie-file>, which contains the session cookie, be passed with the request. <cookie-file> specifies the path and name of the cookie file.

When you use curl, you log in at the beginning of your session and log out at the end of the session. When you log in, you must save the cookie returned from the login request. You must provide the cookie with every subsequent curl command.

-k

Specifies that the curl program not attempt to verify the server certificate against the list of certificate authorities included with the curl software.

The switch uses self-signed certificates. By default, the curl program attempts to verify certificates against its list of certificate authorities, and attempts to verify self-signed certificates fail. Therefore you must use the –k option to disable attempts to verify self-signed certificates against a certificate authority.

--noproxy

Specifies that a web proxy is not required. The --noproxy option is appropriate where execution of curl commands does not need a proxy to access the applications.

If your network is configured to require a proxy to access applications, use the --proxy option instead of the --noproxy option.

-d '<string>'

Specifies that curl send the data in <string> in a POST request using the content-type application/x-www-form-urlencoded.

-X

Specifies a method that curl would not use by default. Typically used with PUT or DELETE methods only.

-H or --header <header>

Specifies an extra header in the HTTP request.

-D-

Specifies that curl write the returned protocol headers to the standard output file. Used for debugging.

More options can be used to customize your experience for your environment. For more information about curl options, see:

https://curl.haxx.se/docs/manpage.html