JFrog Help Center

Our new portal is coming soon!
Documentation + Knowledge Base







Overview

The Private Distribution Network (PDN) 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.

Usage

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

Using and Configuring cURL

Base URL

The Platform REST URL is constructed of: 

<JFrog URL>/<Service Context>/api/<API-Version>

In this document, you will find the relevant PDN Server and PDN Nodes REST APIs as well as the Open Metrics related to PDN.


PDN APIs


PDN Node APIs

Generic Download

Description: Downloads a file by the specified path from PDN.
Since: 1.0.1
Security: Artifactory credentials, with read permissions on the path
Usage: GET /artifactory/example-repo-local/example-directory/example-file.zip

cURL Exampl
curl -u admin:password -X GET http://{pdn-node-host}:8089/artifactory/example-repo-local/example-directory/example-file.zip -o ./example-file.zip

Response status codes:
200 - Successful download of the file
404 - The file does not exist on the Artifactory connected to the PDN

Ping

Description: Tests the connection with the PDN Node.
Since: 1.0.1
Security: No authentication is required
Usage: GET /api/v1/ping

cURL Example
curl -X GET http://{pdn-node-host}:8089/api/v1/ping

Response status codes:
200 - The node is available
5xx - The node is unavailable


PDN Server APIs

The following REST APIs are used for the PDN Server.


Ping

Description: Tests the connection with the PDN Server.
Since: 1.0.1
Security: No authentication is required
Usage: GET /api/v1/system/ping

cURL Example
$ curl -X GET "http://{pdn-server-host}:8082/pdnserver/api/v1/system/ping"

Response status codes:
200 - The server is available
404, 5xx
- The server is unavailable

Liveness

Description: Tests the PDN Server's liveness.
Since: 1.0.1
Security: No authentication is required
Usage: GET /api/v1/system/liveness

cURL Example
curl -X GET "http://{pdn-server-host}:8082/pdnserver/api/v1/system/liveness"

Response status codes:
200 - The server is alive
404, 5xx - The server is not alive

Readiness

Description: Tests the PDN Server's readiness.
Since: 1.0.1
Security: No authentication is required
Usage: GET /api/v1/system/readiness

cURL Example
curl -X GET "http://{pdn-server-host}:8082/pdnserver/api/v1/system/readiness"

Response status codes:
200 - The server is ready to accept traffic
404, 5xx - The server is not ready to accept traffic 

Clear Cache

Description: Cleans files from all the PDN Servers and PDN Nodes cache by NodeID, GroupId - without a status.
Since: 1.1.3
Security: No authentication is required
Usage: GET /api/v1/file/cache/:filepath with 2 query params group and node


PDN Metrics

PDN supports Open Metrics, a Cloud Native Computing Foundation sandbox project.

Credentials for Accessing Open Metrics

An admin user can create a scoped access token using system:metrics:r and use that token as the credentials for getting the service metrics. The admin can create a read-only access token to get metrics, which then enables anyone with the read-only token to read metrics. To learn more, see Access Token Structure.

Enabling PDN Open Metrics

To enable metrics for the PDN Server, make the following configuration changes to the PDN Server system.yaml.

pdnserver:
  metrics:
    enabled: true
    interval: 5
    exclude:
      - prefix_1
      - prefix_2

Next, to enable metrics in the PDN Node, make the following configuration changes to the PDN Node system.yaml.

pdnNode:
  metrics:
    enabled: true
    interval: 5
    exclude:
      - prefix_1
      - prefix_2
    basicAuthUsername: <username>
    basicAuthPassword: <password>

PDN Server Metrics

Description: Gets the metrics for the PDN Server.
Since: 1.0.1
Security: Requires a valid Scoped Token, which contains the Scope “system:metrics:r”.
Usage: GET /api/v1/metrics
Authorization: N/A
Content-Type: application/x-www-form-urlencoded
Example: Here is an example of the PDN Server metrics; a full list can be obtained by accessing the endpoint.

# NAME go_memstats_heap_alloc_bytes
# TYPE Gauge
# HELP Process go heap allocated bytes
#
# NAME app_get_block_duration_secs
# TYPE Histogram
# HELP Time to retrieve a cache-block from Artifactory, in seconds

PDN Node Metrics

Description: Gets the metrics for the PDN Node.
Since: 1.0.1
Security: Basic authorization (credentials are retrieved from the system.yaml).
Usage: GET /api/v1/metrics
Authorization: N/A
Content-Type: application/x-www-form-urlencoded
Example: Here is an example of the PDN Node metrics; a full list can be obtained by accessing the endpoint.

# NAME app_files_served 
# TYPE Gauge
# HELP Total number of files served by the download service
#
# NAME app_download_speed
# TYPE Histogram
# HELP Download speed of each file, in MB/s
  • No labels
Copyright © 2023 JFrog Ltd.