cURL Integration

This command executes a cURL command using the Artifactory details you have configured. The command expects the cURL client to be included in your PATH.

Note: This command supports only Artifactory REST APIs, which are accessible under https://<JFrog base URL>/artifactory/api/.


Commands Params

ParameterCommand / Description
Command namert curl
Abbreviationrt cl

Command Options

OptionDescription
--server-id[Optional] Server ID configured using the jf c add command. If not specified, the default configured server is used.

Environment Variables

VariableDescription
JFROG_CLI_SERVER_ID[Optional] Server ID to use as an alternative to --server-id. The --server-id flag takes priority if both are set.

Command Arguments

ArgumentDescription
cURL arguments and flagsThe same list of arguments and flags passed to cURL, except for the following changes: (1) The full Artifactory URL should not be passed. Instead, the REST endpoint URI should be sent. (2) The login credentials should not be passed. Instead, the --server-id should be used.

Supported cURL Options

OptionDescriptionExample
-XHTTP method-XGET, -XPOST, -XPUT, -XDELETE
-HAdd HTTP header-H "Content-Type: application/json"
-dSend request data/body-d '{"key":"value"}'
-vVerbose outputShows detailed request/response
-sSilent modeSuppress progress meter
-oOutput to file-o response.json
-iInclude headersInclude response headers in output

Authentication

Servers can be configured with any of the following authentication methods:

  • Username and Password
  • Access Token
  • API Key

cURL Integration Examples

Example 1: Send a GET Request to the Default Server

Execute the cURL client to send a GET request to the /api/build endpoint on the default configured Artifactory server.

jf rt curl -XGET /api/build

Example 2: Send a GET Request to a Specific Server

Execute the cURL client to send a GET request to the /api/build endpoint on the Artifactory server configured with the ID my-rt-server.

jf rt curl -XGET /api/build --server-id my-rt-server

Example 3: Send a POST Request with JSON Data

Execute the cURL client to create a local repository using the REST API.

jf rt curl -XPOST -H "Content-Type: application/json" \
  -d '{"key":"my-repo","rclass":"local","packageType":"generic"}' \
  /api/repositories/my-repo

Example 4: Ping the Artifactory Server

Verify connectivity to the Artifactory server.

jf rt curl -XGET /api/system/ping

Example 5: Get System Version

Retrieve the Artifactory version information.

jf rt curl -XGET /api/system/version

Example 6: Use Verbose Mode for Debugging

Execute with verbose output to see request and response details.

jf rt curl -v -XGET /api/system/version

Example 7: Delete a Repository

Delete a repository using the DELETE method.

jf rt curl -XDELETE /api/repositories/my-temp-repo

Example 8: Use Environment Variable for Server Selection

Use the JFROG_CLI_SERVER_ID environment variable instead of --server-id.

export JFROG_CLI_SERVER_ID=my-rt-server
jf rt curl -XGET /api/build

Example 9: Reload Plugins

Reload Artifactory plugins (requires admin permissions).

jf rt curl -XPOST /api/plugins/reload

Example 10: Upload Content with PUT

Upload content to Artifactory storage.

jf rt curl -XPUT -d "file content here" /my-repo/path/to/file.txt