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
| Parameter | Command / Description |
|---|---|
| Command name | rt curl |
| Abbreviation | rt cl |
Command Options
| Option | Description |
|---|---|
--server-id | [Optional] Server ID configured using the jf c add command. If not specified, the default configured server is used. |
Environment Variables
| Variable | Description |
|---|---|
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
| Argument | Description |
|---|---|
| cURL arguments and flags | The 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
| Option | Description | Example |
|---|---|---|
-X | HTTP method | -XGET, -XPOST, -XPUT, -XDELETE |
-H | Add HTTP header | -H "Content-Type: application/json" |
-d | Send request data/body | -d '{"key":"value"}' |
-v | Verbose output | Shows detailed request/response |
-s | Silent mode | Suppress progress meter |
-o | Output to file | -o response.json |
-i | Include headers | Include 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/buildExample 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-serverExample 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-repoExample 4: Ping the Artifactory Server
Verify connectivity to the Artifactory server.
jf rt curl -XGET /api/system/pingExample 5: Get System Version
Retrieve the Artifactory version information.
jf rt curl -XGET /api/system/versionExample 6: Use Verbose Mode for Debugging
Execute with verbose output to see request and response details.
jf rt curl -v -XGET /api/system/versionExample 7: Delete a Repository
Delete a repository using the DELETE method.
jf rt curl -XDELETE /api/repositories/my-temp-repoExample 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/buildExample 9: Reload Plugins
Reload Artifactory plugins (requires admin permissions).
jf rt curl -XPOST /api/plugins/reloadExample 10: Upload Content with PUT
Upload content to Artifactory storage.
jf rt curl -XPUT -d "file content here" /my-repo/path/to/file.txtUpdated 8 days ago
