CINXE.COM

RubyGems.org API - RubyGems Guides

<!DOCTYPE html> <html lang="en-us"> <head> <title>RubyGems.org API - RubyGems Guides</title> <meta charset="utf-8" /> <link rel="icon" href="/favicon.ico" type="image/x-icon"> <link rel="icon" href="/favicon.icns"> <meta http-equiv="Description" name="Description" content="Tutorials, guides, FAQs for RubyGems package management" /> <meta http-equiv="Keywords" name="Keywords" content="rubygems, gems, programming, ruby, packages" /> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" name="viewport"> <link href="/stylesheets/application.css" rel="stylesheet" type="text/css" /> <script src="//code.jquery.com/jquery-3.6.0.min.js"></script> <script src="/javascripts/mobile-nav.js" type="text/javascript"></script> <script src="//use.typekit.net/omu5dik.js" type="text/javascript"></script> <script> try{Typekit.load();}catch(e){} </script> <script> $(function() { var path = window.location.pathname; $('a.nav--v__link[href="'+path.substring(0, path.length -1)+'"]').addClass('is-active'); var header_link = $('a.header__nav-link[href="'+path.substring(0, path.length -1)+'"]'); if(header_link.length > 0) { $('.header__nav-links a').removeClass('is-active'); header_link.addClass('is-active'); } }); </script> <!--[if !IE]>--> <meta name="viewport" content="width=device-width"> <script type="text/javascript"> window.scrollTo(0, 1); </script> <!--<![endif]--> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body class="default"> <header class="header header--interior"> <div class="l-wrap--header"> <a class="header__logo-wrap" href="https://rubygems.org/"> <span class="header__logo" data-icon="⬡">⬢</span> <span class="t-hidden">RubyGems</span> </a> <a class="header__club-sandwich" href="#"> <span class="t-hidden">Navigation menu</span> </a> <div class="header__nav-links-wrap"> <form accept-charset="UTF-8" action="https://rubygems.org/search" class="header__search-wrap" id="main-search" method="get"> <input class="header__search" id="query" name="query" placeholder="Search Gems&hellip;" type="search" /> <label for="query"> <span class="t-hidden">Search gems</span> </label> <input class="header__search__icon" id="search_submit" type="submit" value="⌕" /> </form> <nav class="header__nav-links"> <a class="header__nav-link" href="https://rubygems.org/releases">Releases</a> <a class="header__nav-link" href="https://blog.rubygems.org">Blog</a> <a class="header__nav-link" href="https://rubygems.org/gems">Gems</a> <a class="header__nav-link is-active" href="/">Guides</a> <a class="header__nav-link" href="/contributing">Contribute</a> </nav> </div> </div> </header> <main class="main--interior"> <div class="l-wrap--b"> <a class="t-display page__heading" href="/">Guides</a> <div class="l-overflow"> <div class="l-col--l"> <ul class="nav--v"> <li><a class="nav--v__link" href="/rubygems-basics">RubyGems Basics</a></li> <li><a class="nav--v__link" href="/what-is-a-gem">What is a gem?</a></li> <li><a class="nav--v__link" href="/make-your-own-gem">Make your own gem</a></li> <li><a class="nav--v__link" href="/gems-with-extensions">Gems with Extensions</a></li> <li><a class="nav--v__link" href="/name-your-gem">Name your gem</a></li> <li><a class="nav--v__link" href="/publishing">Publishing your gem</a></li> <li><a class="nav--v__link" href="/security">Security Practices</a></li> <li><a class="nav--v__link" href="/managing-owners-using-ui">Managing owners using UI</a></li> <li><a class="nav--v__link" href="/removing-a-published-gem">Removing a Published gem</a></li> <li><a class="nav--v__link" href="/ssl-certificate-update">SSL Certificate Update</a></li> <li><a class="nav--v__link" href="/patterns">Patterns</a></li> <li><a class="nav--v__link" href="/specification-reference">Specification Reference</a></li> <li><a class="nav--v__link" href="/command-reference">Command Reference</a></li> <li><a class="nav--v__link" href="/rubygems-org-api">RubyGems.org API</a></li> <li><a class="nav--v__link" href="/rubygems-org-api-v2">RubyGems.org API V2.0</a></li> <li><a class="nav--v__link" href="/rubygems-org-compact-index-api">RubyGems.org Compact Index API</a></li> <li><a class="nav--v__link" href="/rubygems-org-rate-limits">RubyGems.org rate limits</a></li> <li><a class="nav--v__link" href="/api-key-scopes">API key scopes</a></li> <li><a class="nav--v__link" href="/run-your-own-gem-server">Run your own gem server</a></li> <li><a class="nav--v__link" href="/setting-up-multifactor-authentication">Setting up multi-factor authentication</a></li> <ul class="nav--v"> <li><a class="nav--v__link" href="/setting-up-webauthn-mfa">Setting up WebAuthn MFA</a></li> <li><a class="nav--v__link" href="/setting-up-otp-mfa">Setting up OTP MFA</a></li> </ul> <li><a class="nav--v__link" href="/using-mfa-in-command-line">Using multi-factor authentication in command line</a></li> <ul class="nav--v"> <li><a class="nav--v__link" href="/using-webauthn-mfa-in-command-line">Using WebAuthn for MFA</a></li> <li><a class="nav--v__link" href="/using-otp-mfa-in-command-line">Using OTP for MFA</a></li> </ul> <li><a class="nav--v__link" href="/mfa-requirement-opt-in">MFA requirement opt in</a></li> <li><a class="nav--v__link" href="/using-s3-source">Using S3 as gem source</a></li> <li><a class="nav--v__link" href="/resources">Resources</a></li> <li><a class="nav--v__link" href="/contributing">Contributing to RubyGems</a></li> <li><a class="nav--v__link" href="/faqs">Frequently Asked Questions</a></li> <li><a class="nav--v__link" href="/plugins">Plugins</a></li> <li><a class="nav--v__link" href="/cve">Common Vulnerabilities and Exposures</a></li> <li><a class="nav--v__link" href="/releasing-rubygems">Releasing RubyGems</a></li> <li><a class="nav--v__link" href="/trusted-publishing">Trusted Publishing</a></li> <ul class="nav--v"> <li><a class="nav--v__link" href="/trusted-publishing/adding-a-publisher">Adding to an existing gem</a></li> <li><a class="nav--v__link" href="/trusted-publishing/pushing-a-new-gem">Pushing a new gem</a></li> <li><a class="nav--v__link" href="/trusted-publishing/releasing-gems">Releasing gems</a></li> </ul> <li><a class="nav--v__link" href="/credits">Credits</a></li> </ul> </div> <div class="l-colspan--r"> <div class="t-body"> <p><em class="t-gray">Details on interacting with RubyGems.org over HTTP.</em></p> <blockquote> <p>NOTE: The API is a work in progress, and <a href="https://github.com/rubygems/rubygems.org">can use your help!</a> RubyGems itself and the <a href="https://github.com/rubygems/rubygems">RubyGems gem</a> use the API to push gems, add owners, and more.</p> </blockquote> <ul> <li><a href="#api-authorization">API Authorization</a>: How to authenticate with RubyGems.org</li> <li><a href="#rate-limits">Rate Limits</a></li> <li><a href="#gem-methods">Gem Methods</a>: Query or create gems to be hosted</li> <li><a href="#gem-version-methods">Gem Version Methods</a>: Query for information about versions of a particular gem</li> <li><a href="#gem-download-methods">Gem Download Methods</a>: Query for download statistics</li> <li><a href="#owner-methods">Owner Methods</a>: Manage owners for gems</li> <li><a href="#webhook-methods">Webhook Methods</a>: Manage notifications for when gems are pushed</li> <li><a href="#activity-methods">Activity Methods</a>: Query for information about site-wide activity</li> <li><a href="#misc-methods">Misc Methods</a>: Various other interactions with the site</li> </ul> <h2 id="api-authorization">API Authorization</h2> <p>Some API calls require an Authorization header. To create or view existing API keys, click on your username when logged in to <a href="https://rubygems.org">RubyGems.org</a>, ‘Settings’, and then ‘API Keys’. Here’s an example of using an API key:</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl -H 'Authorization:YOUR_API_KEY' \ https://rubygems.org/api/v1/some_api_call.json </code></pre></div></div> <p>If you are using Multi-factor authentication, you will need to provide one-time passcode in the <code class="language-plaintext highlighter-rouge">OTP</code> header. Here’s an example of using your API key with a OTP:</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl -H 'Authorization:YOUR_API_KEY' \ -H 'OTP:YOUR_ONE_TIME_PASSCODE' \ https://rubygems.org/api/v1/some_api_call.json </code></pre></div></div> <h2 id="ruby-library">Ruby Library</h2> <p>You can also interact with RubyGems.org using Ruby.</p> <p>The <a href="https://rubygems.org/gems/gems">gems</a> client provides a Ruby interface to all the resources listed below. This library has <a href="https://rubydoc.info/gems/gems">full documentation</a> that includes some basic usage examples in the README. You can install the library with the command:</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>gem install gems </code></pre></div></div> <h2 id="rate-limits">Rate Limits</h2> <p>Please see <a href="/rubygems-org-rate-limits">RubyGems.org ratelimits</a></p> <h2 id="gem-methods">Gem Methods</h2> <h3 id="get---apiv1gemsgem-namejsonyaml">GET - <code class="language-plaintext highlighter-rouge">/api/v1/gems/[GEM NAME].(json|yaml)</code></h3> <p>Returns some basic information about the given gem. See below an example response for the gem “rails” in JSON format:</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl https://rubygems.org/api/v1/gems/rails.json { "name": "rails", "downloads": 7528417, "version": "3.2.1", "version_downloads": 47602, "authors": "David Heinemeier Hansson", "info": "Ruby on Rails is a full-stack web framework optimized for programmer happiness and sustainable productivity. It encourages beautiful code by favoring convention over configuration.", "project_uri": "http://rubygems.org/gems/rails", "gem_uri": "http://rubygems.org/gems/rails-3.2.1.gem", "homepage_uri": "http://www.rubyonrails.org", "wiki_uri": "http://wiki.rubyonrails.org", "documentation_uri": "http://api.rubyonrails.org", "mailing_list_uri": "http://groups.google.com/group/rubyonrails-talk", "source_code_uri": "http://github.com/rails/rails", "bug_tracker_uri": "http://github.com/rails/rails/issues", "dependencies": { "development": [], "runtime": [ { "name": "actionmailer", "requirements":"= 3.2.1" }, { "name": "actionpack", "requirements": "= 3.2.1" }, { "name": "activerecord", "requirements": "= 3.2.1" }, { "name": "activeresource", "requirements": "= 3.2.1" }, { "name": "activesupport", "requirements": "= 3.2.1" }, { "name": "bundler", "requirements": "~&gt; 1.0" }, { "name": "railties", "requirements": "= 3.2.1" } ] } } } </code></pre></div></div> <h3 id="get---apiv1searchjsonyamlqueryyour-query">GET - <code class="language-plaintext highlighter-rouge">/api/v1/search.(json|yaml)?query=[YOUR QUERY]</code></h3> <p>Submit a search to RubyGems.org for active gems, just like a search query on the site. Returns an array of the JSON or YAML representation of gems that match.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl 'https://rubygems.org/api/v1/search.json?query=cucumber' $ curl 'https://rubygems.org/api/v1/search.yaml?query=cucumber' </code></pre></div></div> <p>The results are paginated so the API call will return only the first 30 matched gems. To get subsequent results, use the page query parameter until an empty response is received.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl 'https://rubygems.org/api/v1/search.json?query=cucumber&amp;page=2' </code></pre></div></div> <h3 id="get---apiv1gemsjsonyaml">GET - <code class="language-plaintext highlighter-rouge">/api/v1/gems.(json|yaml)</code></h3> <p>List all gems that you own. Returns an array of the JSON or YAML representation of gems you own.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl -H 'Authorization:rubygems_b9ce70c306b3a2e248679fbbbd66722d408d3c8c4f00566c' \ https://rubygems.org/api/v1/gems.json </code></pre></div></div> <h3 id="post---apiv1gems">POST - <code class="language-plaintext highlighter-rouge">/api/v1/gems</code></h3> <p>Submit a gem to RubyGems.org. Must post a built RubyGem in the request body.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl --data-binary @gemcutter-0.2.1.gem \ -H 'Authorization:rubygems_b9ce70c306b3a2e248679fbbbd66722d408d3c8c4f00566c' \ https://rubygems.org/api/v1/gems Successfully registered gem: gemcutter (0.2.1) </code></pre></div></div> <h3 id="delete---apiv1gemsyank">DELETE - <code class="language-plaintext highlighter-rouge">/api/v1/gems/yank</code></h3> <p>Remove a gem from RubyGems.org’s index. Platform is optional.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl -X DELETE -H 'Authorization:rubygems_b9ce70c306b3a2e248679fbbbd66722d408d3c8c4f00566c' \ -d 'gem_name=bills' -d 'version=0.0.1' \ -d 'platform=x86-darwin-10' \ https://rubygems.org/api/v1/gems/yank Successfully yanked gem: bills (0.0.1) </code></pre></div></div> <h3 id="get---apiv1gemsgem-namereverse_dependenciesjson">GET - <code class="language-plaintext highlighter-rouge">/api/v1/gems/[GEM NAME]/reverse_dependencies.json</code></h3> <p>List dependants of the specified gem. This is all the dependants whose latest version depend on the particular gem. Returns an array that includes names of the dependant gems.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl https://rubygems.org/api/v1/gems/shoulda/reverse_dependencies.json [ "jeweler", "rubigen", "verhoeff", "vanilla", "soup", ... ] </code></pre></div></div> <h2 id="gem-version-methods">Gem Version Methods</h2> <h3 id="get---apiv1versionsgem-namejsonyaml">GET - <code class="language-plaintext highlighter-rouge">/api/v1/versions/[GEM NAME].(json|yaml)</code></h3> <p>Returns an array of gem version details like the below:</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl https://rubygems.org/api/v1/versions/coulda.json [ { "authors" : "Evan David Light", "built_at" : "2011-08-08T04:00:00.000Z", "created_at" : "2011-08-08T21:23:40.254Z", "description" : "Behaviour Driven Development derived from Cucumber but as an internal DSL with methods for reuse", "downloads_count" : 2224, "number" : "0.7.1", "summary" : "Test::Unit-based acceptance testing DSL", "platform" : "ruby", "ruby_version" : nil, "prerelease" : false, "licenses" : nil, "requirements" : nil, "sha" : "777c3a7ed83e44198b0a624976ec99822eb6f4a44bf1513eafbc7c13997cd86c" } ] </code></pre></div></div> <h3 id="get---apiv1versionsgem-namelatestjson">GET - <code class="language-plaintext highlighter-rouge">/api/v1/versions/[GEM NAME]/latest.json</code></h3> <p>Returns an object containing the latest version of particular gem.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl https://rubygems.org/api/v1/versions/rails/latest.json { "version": "4.2.1" } </code></pre></div></div> <h3 id="get---apiv1timeframe_versionsjson">GET - <code class="language-plaintext highlighter-rouge">/api/v1/timeframe_versions.json</code></h3> <p>Returns an array of gem versions that were created within the timeframe specified by the timestamp parameters.</p> <p>An iso8601 timestamp parameter named <code class="language-plaintext highlighter-rouge">from</code> is required. This is the time from which you’d like to start querying. You may include an iso8601 timestamp parameter named <code class="language-plaintext highlighter-rouge">to</code>. If present, only the versions created within <code class="language-plaintext highlighter-rouge">from</code> and <code class="language-plaintext highlighter-rouge">to</code> will be returned. If <code class="language-plaintext highlighter-rouge">to</code> is not given, all versions created between <code class="language-plaintext highlighter-rouge">from</code> and the current time will be returned.</p> <p>NOTE: The timeframe you specify with <code class="language-plaintext highlighter-rouge">from</code> and <code class="language-plaintext highlighter-rouge">to</code> cannot exceed a 7 day span.</p> <p>The results are paginated so the API call will return only the first 30 versions in your timeframe. To get subsequent results, use the page query parameter until an empty response is received.</p> <p>Example response:</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl 'https://rubygems.org/api/v1/timeframe_versions.json?from=2019-01-18T21:24:29Z&amp;to=2019-01-18T21:24:31Z [{ "name": "rails", "downloads": 158094751, "version": "6.0.0.beta1", "version_downloads": 677, "platform": "ruby", "authors": "David Heinemeier Hansson", "info": "Ruby on Rails is a full-stack web framework optimized for programmer happiness and sustainable productivity. It encourages beautiful code by favoring convention over configuration.", "licenses": ["MIT"], "metadata": {}, "sha": "f70cc2e606eafd6c3fd1d7e15f015d6a3e5626d34724ba5c0114922a8eb864b8", "project_uri": "http://localhost/gems/rails", "gem_uri": "http://localhost/gems/rails-6.0.0.beta1.gem", "homepage_uri": "http://rubyonrails.org", "wiki_uri": "", "documentation_uri": "http://api.rubyonrails.org", "mailing_list_uri": "http://groups.google.com/group/rubyonrails-talk", "source_code_uri": "http://github.com/rails/rails", "bug_tracker_uri": "http://github.com/rails/rails/issues", "changelog_uri": null, "dependencies": { "development": [], "runtime": [{ "name": "actioncable", "requirements": "= 6.0.0.beta1" }, { "name": "actionmailbox", "requirements": "= 6.0.0.beta1" }, { "name": "actionmailer", "requirements": "= 6.0.0.beta1" }, { "name": "actionpack", "requirements": "= 6.0.0.beta1" }, { "name": "actiontext", "requirements": "= 6.0.0.beta1" }, { "name": "actionview", "requirements": "= 6.0.0.beta1" }, { "name": "activejob", "requirements": "= 6.0.0.beta1" }, { "name": "activemodel", "requirements": "= 6.0.0.beta1" }, { "name": "activerecord", "requirements": "= 6.0.0.beta1" }, { "name": "activestorage", "requirements": "= 6.0.0.beta1" }, { "name": "activesupport", "requirements": "= 6.0.0.beta1" }, { "name": "bundler", "requirements": "\u003e= 1.3.0" }, { "name": "railties", "requirements": "= 6.0.0.beta1" }, { "name": "sprockets-rails", "requirements": "\u003e= 2.0.0" }] }, "built_at": "2019-01-18T00:00:00.000Z", "created_at": "2019-01-18T21:24:30.197Z", "description": "Ruby on Rails is a full-stack web framework optimized for programmer happiness and sustainable productivity. It encourages beautiful code by favoring convention over configuration.", "downloads_count": 677, "number": "6.0.0.beta1", "summary": "Full-stack web application framework.", "rubygems_version": "\u003e= 1.8.11", "ruby_version": "\u003e= 2.5.0", "prerelease": true, "requirements": [] }] </code></pre></div></div> <h2 id="gem-download-methods">Gem Download Methods</h2> <h3 id="get---apiv1downloadsjsonyaml">GET - <code class="language-plaintext highlighter-rouge">/api/v1/downloads.(json|yaml)</code></h3> <p>Returns an object containing the total number of downloads on RubyGems.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl https://rubygems.org/api/v1/downloads.json { "total": 461672727 } </code></pre></div></div> <h3 id="get---apiv1downloadsgem-name-gem-versionjsonyaml">GET - <code class="language-plaintext highlighter-rouge">/api/v1/downloads/[GEM NAME]-[GEM VERSION].(json|yaml)</code></h3> <p>Returns an object containing the total number of downloads for a particular gem as well as the total number of downloads for the specified version.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl https://rubygems.org/api/v1/downloads/rails_admin-0.0.0.json { "version_downloads": 3142, "total_downloads": 3142 } </code></pre></div></div> <h2 id="owner-methods">Owner Methods</h2> <h3 id="get---apiv1ownersuser-handleuser-idgemsjsonyaml">GET - <code class="language-plaintext highlighter-rouge">/api/v1/owners/[USER HANDLE|USER ID]/gems.(json|yaml)</code></h3> <p>View all gems for a user. This is all the gems a user can push to. Owner gems list can be requested with both user handle or user id.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl https://rubygems.org/api/v1/owners/qrush/gems.json [ { "name": "factory_bot", ... }, ... ] </code></pre></div></div> <h3 id="get---apiv1gemsgem-nameownersjsonyaml">GET - <code class="language-plaintext highlighter-rouge">/api/v1/gems/[GEM NAME]/owners.(json|yaml)</code></h3> <p>View all owners of a gem. These users can all push to this gem.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl https://rubygems.org/api/v1/gems/gemcutter/owners.json [ { "email": "nick@gemcutter.org" }, { "email": "ddollar@gmail.com" } ] </code></pre></div></div> <h3 id="post---apiv1gemsgem-nameowners">POST - <code class="language-plaintext highlighter-rouge">/api/v1/gems/[GEM NAME]/owners</code></h3> <p>Add an owner to a RubyGem you own, giving that user permission to manage it.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl -H 'Authorization:rubygems_b9ce70c306b3a2e248679fbbbd66722d408d3c8c4f00566c' \ -F 'email=josh@technicalpickles.com' \ https://rubygems.org/api/v1/gems/gemcutter/owners Owner added successfully. </code></pre></div></div> <h3 id="delete---apiv1gemsgem-nameowners">DELETE - <code class="language-plaintext highlighter-rouge">/api/v1/gems/[GEM NAME]/owners</code></h3> <p>Remove a user’s permission to manage a RubyGem you own.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl -X DELETE -H 'Authorization:rubygems_b9ce70c306b3a2e248679fbbbd66722d408d3c8c4f00566c' \ -d "email=josh@technicalpickles.com" \ https://rubygems.org/api/v1/gems/gemcutter/owners Owner removed successfully. </code></pre></div></div> <h2 id="profile-methods">Profile Methods</h2> <h3 id="get---apiv1profilesuser-handleuser-idjsonyaml">GET - <code class="language-plaintext highlighter-rouge">/api/v1/profiles/[USER HANDLE|USER ID].(json|yaml)</code></h3> <p>View basic user info for a user.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl https://rubygems.org/api/v1/profiles/qrush [ { "id": 1, "handle": "qrush" } ] $ curl https://rubygems.org/api/v1/profiles/1 [ { "id": 1, "handle": "qrush" } ] </code></pre></div></div> <h3 id="get---apiv1profilemejsonyaml">GET - <code class="language-plaintext highlighter-rouge">/api/v1/profile/me.(json|yaml)</code></h3> <p>View basic user information for your account, including Multi-factor authentication status. Requires username and password to be passed.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl -u "nick@gemcutter.org:schwwwwing" \ https://rubygems.org/api/v1/profile/me [ { "id": 1, "handle": "qrush", "mfa": "enabled" } ] </code></pre></div></div> <h2 id="webhook-methods">WebHook Methods</h2> <h3 id="get---apiv1web_hooksjsonyaml">GET - <code class="language-plaintext highlighter-rouge">/api/v1/web_hooks.(json|yaml)</code></h3> <p>List the webhooks registered under your account.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl -H 'Authorization:rubygems_b9ce70c306b3a2e248679fbbbd66722d408d3c8c4f00566c' \ https://rubygems.org/api/v1/web_hooks.json { "all gems": [ { "url": "http://gemwhisperer.heroku.com", "failure_count": 1 } ], "rails": [ { "url": "http://example.com", "failure_count": 0 } ] } </code></pre></div></div> <h3 id="post---apiv1web_hooks">POST - <code class="language-plaintext highlighter-rouge">/api/v1/web_hooks</code></h3> <p>Create a webhook. Requires two parameters: <code class="language-plaintext highlighter-rouge">gem_name</code> and <code class="language-plaintext highlighter-rouge">url</code>. Specify <code class="language-plaintext highlighter-rouge">*</code> for the <code class="language-plaintext highlighter-rouge">gem_name</code> parameter to apply the hook globally to all gems.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl -X POST -H 'Authorization:rubygems_b9ce70c306b3a2e248679fbbbd66722d408d3c8c4f00566c' \ -F 'gem_name=rails' -F 'url=http://example.com' \ https://rubygems.org/api/v1/web_hooks Successfully created webhook for rails to http://example.com $ curl -X POST -H 'Authorization:rubygems_b9ce70c306b3a2e248679fbbbd66722d408d3c8c4f00566c' \ -F 'gem_name=*' -F 'url=http://example.com' \ https://rubygems.org/api/v1/web_hooks Successfully created webhook for all gems to http://example.com </code></pre></div></div> <h3 id="delete---apiv1web_hooksremove">DELETE - <code class="language-plaintext highlighter-rouge">/api/v1/web_hooks/remove</code></h3> <p>Remove a webhook. Requires two parameters: <code class="language-plaintext highlighter-rouge">gem_name</code> and <code class="language-plaintext highlighter-rouge">url</code>. Specify <code class="language-plaintext highlighter-rouge">*</code> for the <code class="language-plaintext highlighter-rouge">gem_name</code> parameter to apply the hook globally to all gems.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl -X DELETE -H 'Authorization:rubygems_b9ce70c306b3a2e248679fbbbd66722d408d3c8c4f00566c' \ -d 'gem_name=rails' -d 'url=http://example.com' \ https://rubygems.org/api/v1/web_hooks/remove Successfully removed webhook for rails to http://example.com $ curl -X DELETE -H 'Authorization:rubygems_b9ce70c306b3a2e248679fbbbd66722d408d3c8c4f00566c' \ -d 'gem_name=*' -d 'url=http://example.com' \ https://rubygems.org/api/v1/web_hooks/remove Successfully removed webhook for all gems to http://example.com </code></pre></div></div> <h3 id="post---apiv1web_hooksfire">POST - <code class="language-plaintext highlighter-rouge">/api/v1/web_hooks/fire</code></h3> <p>Test fire a webhook. This can be used to test out an endpoint at any time, for example when you’re developing your application. Requires two parameters: <code class="language-plaintext highlighter-rouge">gem_name</code> and <code class="language-plaintext highlighter-rouge">url</code>. Specify <code class="language-plaintext highlighter-rouge">*</code> for the gem_name parameter to apply the hook globally to all gems.</p> <p>An <code class="language-plaintext highlighter-rouge">Authorization</code> header is included with every fired webhook so you can be sure the request came from RubyGems.org. The value of the header is the SHA2-hashed concatenation of the gem name, the gem version and your API key.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl -H 'Authorization:rubygems_b9ce70c306b3a2e248679fbbbd66722d408d3c8c4f00566c' \ -F 'gem_name=rails' -F 'url=http://example.com' \ https://rubygems.org/api/v1/web_hooks/fire Successfully deployed webhook for rails to http://example.com $ curl -H 'Authorization:rubygems_b9ce70c306b3a2e248679fbbbd66722d408d3c8c4f00566c' \ -F 'gem_name=*' -F 'url=http://example.com' \ https://rubygems.org/api/v1/web_hooks/fire Successfully deployed webhook for all gems to http://example.com </code></pre></div></div> <h2 id="activity-methods">Activity Methods</h2> <h3 id="get---apiv1activitylatest">GET - <code class="language-plaintext highlighter-rouge">/api/v1/activity/latest</code></h3> <p>Pulls the 50 gems most recently added to RubyGems.org (for the first time). Returns an array of the JSON or YAML representation of the gems.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl 'https://rubygems.org/api/v1/activity/latest.json' </code></pre></div></div> <h3 id="get---apiv1activityjust_updated">GET - <code class="language-plaintext highlighter-rouge">/api/v1/activity/just_updated</code></h3> <p>Pulls the 50 most recently updated gems. Returns an array of the JSON or YAML representation of the gem versions.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl 'https://rubygems.org/api/v1/activity/just_updated.json' </code></pre></div></div> <h2 id="misc-methods">Misc Methods</h2> <h3 id="get---apiv1api_keyjsonyaml">GET - <code class="language-plaintext highlighter-rouge">/api/v1/api_key.(json|yaml)</code></h3> <p>Retrieve your API key using HTTP basic auth.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ curl -u "nick@gemcutter.org:schwwwwing" \ https://rubygems.org/api/v1/api_key.json { "rubygems_api_key": "701243f217cdf23b1370c7b66b65ca97" } </code></pre></div></div> <h3 id="get---apiv1dependenciesgemscomma-delimited-gem-names">GET - <code class="language-plaintext highlighter-rouge">/api/v1/dependencies?gems=[COMMA DELIMITED GEM NAMES]</code></h3> <p>Returns a marshalled array of hashes for all versions of given gems. Each hash contains a gem version with its dependencies making this useful for resolving dependencies.</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ ruby -ropen-uri -rpp -e \ 'pp Marshal.load(open("https://rubygems.org/api/v1/dependencies?gems=rails,thor"))' [{:platform=&gt;"ruby", :dependencies=&gt; [["bundler", "~&gt; 1.0"], ["railties", "= 3.0.3"], ["actionmailer", "= 3.0.3"], ["activeresource", "= 3.0.3"], ["activerecord", "= 3.0.3"], ["actionpack", "= 3.0.3"], ["activesupport", "= 3.0.3"]], :name=&gt;"rails", :number=&gt;"3.0.3"}, ... {:number=&gt;"0.9.9", :platform=&gt;"ruby", :dependencies=&gt;[], :name=&gt;"thor"}] </code></pre></div></div> </div> </div> </div> <div class="paginated-nav-links"> <a class="paginated-nav-link--prev" data-icon="&lt;" href="/command-reference"> <span>Previous</span> </a> <a class="paginated-nav-link--next" data-icon="&gt;" href="/rubygems-org-api-v2"> <span>Next</span> </a> </div> </div> </main> <footer class="footer"> <div class="l-wrap--footer"> <div class="l-overflow"> <div class="nav--v l-col--r--pad"> <a class="nav--v__link--footer" href="https://status.rubygems.org/">Status</a> <a class="nav--v__link--footer" href="http://uptime.rubygems.org/">Uptime</a> <a class="nav--v__link--footer" href="https://github.com/rubygems/rubygems.org" target='_blank'>Code</a> <a class="nav--v__link--footer" href="https://groups.google.com/forum/#!forum/rubygems-org" target='_blank'>Discuss</a> <a class="nav--v__link--footer" href="https://rubygems.org/stats">Stats</a> <a class="nav--v__link--footer" href="https://blog.rubygems.org/">Blog</a> <a class="nav--v__link--footer" href="https://rubygems.org/pages/about">About</a> <a class="nav--v__link--footer" href="mailto:support@rubygems.org">Help</a> </div> <div class="l-colspan--l colspan--l--has-border"> <p class="footer__about">RubyGems.org is the Ruby community&rsquo;s gem hosting service. Instantly publish your gems and install them. Use the API to interact and find out more information about available gems. Become a contributor and enhance the site with your own changes.</p> </div> </div> </div> <div class="footer__sponsors-wrap"> <div class="footer__sponsors"> <a class="footer__sponsor footer__sponsor__ruby_central" href="https://rubycentral.org/" target="_blank" rel="noreferrer"> Supported by <span class="t-hidden">Ruby Central</span> </a> <a class="footer__sponsor footer__sponsor__dockyard" href="https://dockyard.com/ruby-on-rails-consulting" target="_blank" rel="noreferrer"> Designed by <span class="t-hidden">DockYard</span> </a> <a class="footer__sponsor footer__sponsor__dnsimple" href="https://dnsimple.link/resolving-rubygems" target="_blank" rel="noreferrer"> Resolved with <span class="t-hidden">DNSimple</span> </a> <a class="footer__sponsor footer__sponsor__datadog" href="https://www.datadoghq.com/" target="_blank" rel="noreferrer"> Monitored by <span class="t-hidden">Datadog</span> </a> <a class="footer__sponsor footer__sponsor__fastly" href="https://www.fastly.com/" target="_blank" rel="noreferrer"> Gems served by <span class="t-hidden">Fastly</span> </a> <a class="footer__sponsor footer__sponsor__honeybadger" href="https://www.honeybadger.io/" target="_blank" rel="noreferrer"> Monitored by <span class="t-hidden">Honeybadger</span> </a> <a class="footer__sponsor footer__sponsor__domainr" href="https://domainr.com/" target="_blank" rel="noreferrer"> Verified by <span class="t-hidden">Domainr</span> </a> <a class="footer__sponsor footer__sponsor__whitesource" href="https://www.whitesourcesoftware.com/" target="_blank" rel="noreferrer"> Secured by <span class="t-hidden">Whitesource</span> </a> </div> </div> </footer> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-10315684-2']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10