How to upload and download artifacts using Artifactory REST API? [Video]

How to upload and download artifacts using Artifactory REST API? [Video]

AuthorFullName__c
Joey Naor
articleNumber
000004933
ft:sourceType
Salesforce
FirstPublishedDate
2020-11-18T11:55:17Z
lastModifiedDate
2024-03-10T07:47:15Z
VersionNumber
6

How to upload/deploy and download artifacts using Artifactory REST API?

Video Transcript:
Hi, there I’m Joey from JFrog Support and in this short video, I will show you how to upload and download artifacts from Artifactory using REST API calls. Let’s start by breaking down a simple API call, which downloads a single artifact from Artifactory. You have cURL as the HTTP client, supplied with our Artifactory username and password. Next, we have the HTTP method. This method will change according to the API code we’re using. Then there’s the full Artifactory URL, which includes the path to the artifact that we want to download. Finally, we have the name of the file, which will be saved on our local filestore.

A similar call can be used in order to upload a single artifact. Here, we will use the PUT HTTP method, specify our desired path, which consists of the repository name, directory name, which is optional, and the artifact name. Finally, we’ll specify the actual local artifact, which we’d like to deploy. Please note that in Artifactory, the artifact name will match the one from the URL and not the local file.

Now let’s cover uploading and downloading multiple files and directories using a single operation. To upload multiple artifacts, you will need to write a simple loop using our preferred coding or scripting language. For this example, I’m using a batch script, which looks through all the files in the current directory. On each cycle, the variable file name is equal to the actual artifact file name, which is used within the cURL command.

After executing the batch script, we can see the cURL output of each separate deployment to Artifactory. Although it can use the same loop to download multiple artifacts, there is a REST API call, which does it better. This call will create an archive that contains all the artifacts in the path we specified. This path can either be a specific directory within a repository or the repository route, which will download all the artifacts inside it. Please know that for this call to work, you need to enable the folder download feature in the Artifactory admin panel.

There are countless ways to use the REST API, which allows you to creatively shape scripts that will fully automate your custom operations. I encourage you to explore our REST API documentation, which is linked in description of this video, and attempt to use some of them yourself.

That was my video on uploading and downloading to Artifactory via REST API. Thank you for watching and please feel free to leave your comments, feedback, or questions in the comment section below.