Introduction to the JFrog Platform REST APIs

JFrog REST APIs

Products
JFrog Xray
Content Type
REST API
ft:sourceType
Paligo

The JFrog Platform provides a convenient and up-to-date self-descriptive API that can be used by various tools/frameworks to automate the creation of REST calls.

This document includes information needed for REST API automation with the JFrog Platform.

Usage

The JFrog Platform REST API endpoints can be invoked in any of the standard ways to invoke a RESTful API. This section describes how to use the Platform REST API using cURL as an example.

Using and Configuring cURL

Example: /repo-key/path/to/artifact.ext

You can download cURL here. and learn how to use and configure cURLhere.

Authentication

JFrog Platform's REST API supports these forms of authentication:

  • Basic authentication using your username and password

  • Using Access Tokens instead of a password for basic authentication

  • Using Access Tokens as a bearer token in an authorization header (Authorization: Bearer) with your access token

  • For MyJFrog authentication, see Generate a Token in MyJFrogGenerate a Token in MyJFrog

Base URL

The REST URL is constructed of:

http://<JFROG_PLATFORM_URL>:<ROUTER_PORT>/access/api/v1/

For example:

http://localhost:8082/access/api/v1/

Working with the JFrog Platform on the Cloud

The JFrog Platform on the Cloud offers the same extensive functionality and capabilities for automation as a self-hosted installation, including authentication, use of JFrog CLI, and the REST API endpoints.

As a Cloud service, the URL is different from a self-hosted installation and the REST API endpoints can be reached at:

https://<Server Name>.jfrog.io

Example

The snippets below apply the same described above to an Artifactory Cloud instance named "myArtifactoryCloud" (instead of to a self-hosted installation).

To deploy the file using your username and password for authentication, you would use the following command:

Using cURL with a bearer token

curl -u myUser:myP455w0rd! -X PUT "https://myartifactorycloud.jfrog.io/artifactory/my-repository/my/new/artifact/directory/file.txt" -T Desktop/myNewFile.txt

Using JFrog CLI

jfrog rt u file.txt my-repository/my/new/artifact/directory/ --user=myUser --password=myP455w0rd!

Note that using JFrog CLI is identical with an Artifactory Cloud instance. You only need to configure JFrog CLI with the correct URL for your instance.