PlatformHttpClient relies on Axios to perform HTTP requests. It is a ready to use client to call any JFrog Platform REST API. The endpoint
input must be a relative URL with the pattern <serviceName>/api/<endpoint>
. For example, the methods of the PlatformHttpClient, /artifactory/api/system/ping
, return an object of type IPlatformHttpResponse
or throw an object of type PlatformHttpClientError
as error.
interface PlatformHttpClient { /** * Perform HTTP GET request to the JFrog Platform * @param {string} endpoint - API endpoint. For example, /artifactory/api/repositories * @param {Record<string, string>} headers - additional headers used in the request */ get(endpoint: string, headers?: Record<string, string>): Promise<IPlatformHttpResponse> /** * Perform HTTP POST request to JFrog platform * @param {string} endpoint - API endpoint. For example, /artifactory/api/repositories * @param {any} requestData - data sent in request body * @param {Record<string, string>} headers - additional headers used in the request */ post(endpoint: string, requestData?: any, headers?: Record<string, string>): Promise<IPlatformHttpResponse> /** * Perform HTTP PUT request to JFrog platform * @param {string} endpoint - API endpoint. For example, /artifactory/api/repositories * @param {any} requestData - data sent in request body * @param {Record<string, string>} headers - additional headers used in the request */ put(endpoint: string, requestData?: any, headers?: Record<string, string>): Promise<IPlatformHttpResponse> /** * Perform HTTP PATCH request to JFrog platform * @param {string} endpoint - API endpoint. For example, /artifactory/api/repositories * @param {any} requestData - data sent in request body * @param {Record<string, string>} headers - additional headers used in the request */ patch(endpoint: string, requestData?: any, headers?: Record<string, string>): Promise<IPlatformHttpResponse> /** * Perform HTTP DELETE request to JFrog platform * @param {string} endpoint - API endpoint. For example, /artifactory/api/repositories * @param {Record<string, string>} headers - additional headers used in the request */ delete(endpoint: string, headers?: Record<string, string>): Promise<IPlatformHttpResponse> }