Alternatives to Artifactory Rest API

Alternatives to Artifactory Rest API

Introduction

In this article, we will look at what is the JFrog Artifactory REST API and what capabilities it provides to its users. Then we will explore the alternative to JFrog’s tool - the Packagecloud REST API tool. We will look at Packagecloud’s main features, and the benefits of using it.

                      

The Packagecloud REST API provides a lot of functions for the automatic management of Packagecloud repositories. With Packagecloud, you can easily deploy, manage and distribute your software.

                      

Sign up for Packagecloud for free - it’s the easiest, the most convenient, and the most reliable tool for deploying and distributing your packages.

                       

What is the JFrog Artifactory REST API?

JFrog Artifactory REST API is a set of functions for automatically managing repositories, their settings, security, access rights, and more. Every Artifactory REST API method can be called using any of the standard ways. For example, you can use curl, CLI, your source code, etc.

                     

The Artifactory REST API supports several different authentication methods:

  • Basic authentication using username and password.
  • Basic authentication using username and API key.
  • Using custom header (X-JFrog-Art-Api) with user API key.
  • Using an access token instead of a password for basic authentication.
  • Using the access token as a bearer token in the Authorization: Bearer header with the user’s access token.

                 

Below we will look at the main functions provided by the Artifactory REST API.

                      

What does the JFrog Artifactory Rest API do?

The Artifactory REST API offers its users an extensive set of methods and parameters. Let’s take a look at the most popular methods that you might find useful.

  • Getting detailed information about builds, managing builds, and distributing them.
  • Artifact and storage management.
  • Obtaining detailed statistics on the use of files.
  • Creation of a signed URL.
  • Replacing the key in the signed URL.
  • Create, manage, and run archive policy.
  • Deploy artifacts.
  • Management and synchronization of repositories.
  • Getting the metadata of the repositories.
  • Advanced search for artifacts by various criteria such as name, repository, version, date, etc.
  • Search for templates, licenses, builds, artifact versions.
  • Management of users, their passwords, and access rights.
  • Creation and management of user groups.
  • Management of GPG keys and certificates.
  • System management and configuration.
  • Getting information about plugins.
  • Installing and managing licenses.
  • Import and export of repository content and system settings.

                                      

Use Packagecloud REST API and Packagecloud to manage your repository

The Artifactory REST API has often been used to automate working with Bintray repositories. After the sunset of Bintray, which occurred on May 1, 2021, its users had a need to search for an alternative tool. 

                      

An excellent substitute for it would be Packagecloud. There is also a Packagecloud REST API, which is very simple and easy to use and offers all the necessary methods to automate the work with repositories. Let’s take a closer look at Packagecloud, its main functions, and the advantages of using it.

                         

What is Packagecloud?

Packagecloud is a cloud-based hosted package repository service. Using it, you can easily create repositories, upload packages to them, manage and distribute them. Packagecloud does not depend on the programming language your software is written in, the operating system, or the infrastructure you use.

                     

Check out the Packagecloud free trial and use it with the Packagecloud REST API to manage and deploy your packages.

                                 

What is the packagecloud REST API?

The Packagecloud REST API is a tool for automatically managing Packagecloud repositories. It can be used to automate common tasks for Debian, npm, RubyGems, and Python packages.       In the Packagecloud REST API, all requests must be called over HTTPS. No support for plain text HTTP. Most API requests are authenticated using the API token. API tokens are passed to the API through HTTP Basic Authentication. Packagecloud REST API is versioned. The API version must appear in the request URL, for example, https://packagecloud.io/api/v1/.

                       

What can you do with the Packagecloud REST API?

Let’s list the basic functions that the Packagecloud REST API provides.

  • View statistics that include quantity, time, and detailed information about package downloads and installations.
  • Create, view, and delete the GPG key for the repository.
  • Obtaining packagecloud enterprise license file and GPG signature.
  • Create, delete, and view detailed information about packages.
  • Group packages by specific parameters, such as type, distribution, version, architecture.
  • Check the contents of the package.
  • Get a list of all versions of a package.
  • Promote packages.
  • Search for packages by file name or package type.
  • Create, view, and delete read tokens.
  • Create, delete, and view detailed information about repositories.
  • For each Linux distribution, get a list of all package versions that the distribution supports.
  • Create, delete, and view detailed information about the master token.
  • Search for a master token by repository name or by the user name that owns the repository.
  • Create, edit, delete and view detailed information about the readme repository.

                  

Let’s take a look at one of the most popular examples of using Packagecloud REST API. In this example, we will call the method for searching for a package by the specified parameters. 

                        

We will search packages in the test_repo repository for a user named test_user that contains the word test in the name. The name of the distribution the package is in should be Ubuntu. Only one repository should be contained in the response. 

                        

In this case, the query string will look like this:

curl "https://packagecloud.io/api/v1/repos/test_user/test_repo/search?q=test&dist=ubuntu&per_page=1"

                     

The per_page parameter indicates how many items should be generated in this response. The default value is 30. The value should not be greater than the Max-Per-Page parameter. If per_page is greater than Max-Per-Page, then this parameter is ignored and the maximum allowed number of items is returned.

                     

Instead of specifying a dist parameter that indicates the name of the distribution, you can specify a filter parameter. This parameter is used to search by package type. For example RPMs, Debs, DSCs, Gem, Python, Node.

                 

If you use the dist parameter, then the filter parameter is ignored.

                            

After executing this request in the response, we will receive detailed information about the found package. See example below:             

[
  {
    "name": "test123",
    "distro_version": "RubyGem",
    "created_at": "2017-03-14T14:31:16.000Z",
    "version": "0.0.1",
    "release": null,
    "epoch": null,
    "private": false,
    "type": "gem",
    "filename": "jakedotrb-0.0.1.gem",
    "uploader_name": "test_user",
    "indexed": false,
    "repository_html_url": "/test_user/test_repo",
    "package_url": "/api/v1/repos/test_user/test_repo/package/gem/jakedotrb/0.0.1.json",
    "downloads_detail_url": "/api/v1/repos/test_user/test_repo/package/gem/jakedotrb/0.0.1/stats/downloads/detail.json",
    "downloads_series_url": "/api/v1/repos/test_user/test_repo/package/gem/jakedotrb/0.0.1/stats/downloads/series/daily.json",
    "downloads_count_url": "/api/v1/repos/test_user/test_repo/package/gem/jakedotrb/0.0.1/stats/downloads/count.json",
    "package_html_url": "/test_user/test_repo/packages/gems/jakedotrb-0.0.1.gem",
    "download_url": "https://packagecloud.io/test_user/test_repo/packages/gems/jakedotrb-0.0.1.gem/download",
    "promote_url": "/api/v1/repos/test_user/test_repo/gems/jakedotrb-0.0.1.gem/promote.json",
    "destroy_url": "/api/v1/repos/test_user/test_repo/gems/jakedotrb-0.0.1.gem"
  },
]

                         

You can read detailed information about all the functions of the Packagecloud REST API, as well as find more examples of their use in the official documentation.

                   

Benefits of using Packagecloud REST API

Below are the main benefits that you get using the Packagecloud REST API.

  • Existing open-source API client libraries for Java, Ruby, and Go.
  • The security of your data is guaranteed through the use of HTTPS and HTTP basic authentication.
  • Simple and easy to use.
  • Convenient, customizable pagination.
  • Ability to view detailed statistics about package downloads and installations.
  • Provides all features required for efficient automatic package and repository management.

                      

Conclusion

Automation of working with repositories is very convenient and necessary for developers. Therefore, there is a need to select tools that allow you to organize the automation process. A great tool for this is the Packagecloud REST API, which is a good alternative to the Artifactory REST API. Packagecloud REST API provides developers with all the necessary functions for managing packages and repositories, viewing detailed statistics.

                                       

Sign up for the Packagecloud free trial today and set up your automation process with the Packagecloud REST API.

Hungry for more knowledge?

Related posts