Last active
July 22, 2016 03:50
-
-
Save psprings/be2ce480855595be80299fd17ceae7a7 to your computer and use it in GitHub Desktop.
Wanted to get a list of Artifactory REST API calls that were available without the Pro version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'nokogiri' | |
| require 'open-uri' | |
| require 'yaml' | |
| url = 'https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API' | |
| source_code = open(url).read | |
| doc = Nokogiri::HTML(source_code) | |
| main_content = doc.css('div#main-content').to_s | |
| # Doesn't work yet | |
| # matches = main_content.scan(/<h3 id="ArtifactoryRESTAPI.*">(.*)<\/h3>\n(.*)\n<div/m) | |
| # Split on horizontal rule for now | |
| splits = main_content.split('<hr>') | |
| available_api_calls = Hash.new {|h,k| h[k]=[]} | |
| section = nil | |
| splits.each do |s| | |
| doc = Nokogiri::HTML(s) | |
| unless doc.at('h2').nil? | |
| section = doc.at('h2').text | |
| end | |
| description = nil | |
| artifactory_pro = false | |
| usage = nil | |
| next if doc.at('h3').nil? | |
| next unless doc.at('h3').attribute_nodes.first.value =~ %r{ArtifactoryRESTAPI.*} | |
| name = doc.at('h3').text.strip | |
| # Parse out a few fields: Description, Usage, Notes (this field is looking for the existence of 'Aritfactory Pro') | |
| kids = doc.at('p').children | |
| kids.each_with_index do |child, i| | |
| next if i == 0 | |
| description = child.text[1..-1].strip if kids[i-1].text == 'Description' | |
| usage = child.text[1..-1].strip.split(' ') if kids[i-1].text == 'Usage' | |
| artifactory_pro = true if child.text.include?('Requires Artifactory Pro') || child.text.include?('Requires an enterprise license') | |
| end | |
| # Notes field does not include Artifactory pro append to array of hashes | |
| next if artifactory_pro || usage.nil? | |
| available_api_calls[section] << { 'name' => name, 'description' => description, 'usage' => { 'method' => usage[0], 'path' => usage[1] } } | |
| end | |
| puts available_api_calls.to_yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| BUILDS: | |
| - name: All Builds | |
| description: Provides information on all builds | |
| usage: | |
| method: GET | |
| path: "/api/build" | |
| - name: Builds Diff | |
| description: Compare a build artifacts/dependencies/environment with an older build | |
| to see what has changed (new artifacts added, old dependencies deleted etc). | |
| usage: | |
| method: GET | |
| path: "/api/build/{buildName}/{buildNumber}?diff={OlderbuildNumber}" | |
| ARTIFACTS & STORAGE: | |
| - name: Folder Info | |
| description: Folder Info | |
| usage: | |
| method: GET | |
| path: "/api/storage/{repoKey}/{folder-path}" | |
| - name: File Info | |
| description: File Info | |
| usage: | |
| method: GET | |
| path: "/api/storage/{repoKey}/{filePath}" | |
| - name: Get Storage Summary Info | |
| description: " Returns storage summary information regarding binaries, file store | |
| and repositories." | |
| usage: | |
| method: GET | |
| path: "/api/storageinfo" | |
| - name: Item Properties | |
| description: Item Properties. Optionally return only the properties requested. Supported | |
| by local and local-cached repositories. | |
| usage: | |
| method: GET | |
| path: "/api/storage/{repoKey}/{itemPath}?properties[=x[,y]]" | |
| - name: Retrieve Artifact | |
| description: Retrieves an artifact from the specified destination. | |
| usage: | |
| method: GET | |
| path: "/repo-key/path/to/artifact.ext" | |
| - name: Trace Artifact Retrieval | |
| description: Simulates an artifact retrieval request from the specified location | |
| and returns verbose output about the resolution process. | |
| usage: | |
| method: GET | |
| path: "/repo-key/path/to/artifact.ext?trace" | |
| - name: Archive Entry Download | |
| description: Retrieves an archived resource from the specified archive destination. | |
| usage: | |
| method: GET | |
| path: "/repo-key/path/to/artifact.jar*!*/path/to/archived/resource" | |
| - name: Create Directory | |
| description: Create new directory at the specified destination. | |
| usage: | |
| method: PUT | |
| path: "/repo-key/path/to/directory/" | |
| - name: Deploy Artifact | |
| description: Deploy an artifact to the specified destination. | |
| usage: | |
| method: PUT | |
| path: "/repo-key/path/to/artifact.ext" | |
| - name: Deploy Artifact by Checksum | |
| description: Deploy an artifact to the specified destination by checking if the | |
| artifact content already exists in Artifactory. | |
| usage: | |
| method: PUT | |
| path: "/repo-key/path/to/artifact.ext" | |
| - name: Push Docker Tag to Bintray | |
| description: Push Docker tag to Bintray | |
| usage: | |
| method: POST | |
| path: "/api/bintray/docker/push/{repoKey}" | |
| - name: Delete Item | |
| description: Deletes a file or a folder from the specified destination. | |
| usage: | |
| method: DELETE | |
| path: "/repo-key/path/to/file-or-folder" | |
| - name: Artifact Sync Download | |
| description: Downloads an artifact with or without returning the actual content | |
| to the client. When tracking the progress marks are printed (by default every | |
| 1024 bytes). This is extremely useful if you want to trigger downloads on a remote | |
| Artifactory server, | |
| usage: | |
| method: GET | |
| path: "/api/download/{repoKey}/{filePath}[?content=none/progress][&mark=numOfBytesToPrintANewProgressMark]" | |
| - name: Optimize System Storage | |
| description: | |
| usage: | |
| method: POST | |
| path: | |
| SEARCHES: | |
| - name: Archive Entry Search (Class Search) | |
| description: Search archive entries for classes or any other jar resources. | |
| usage: | |
| method: GET | |
| path: "/api/search/archive?name=[archiveEntryName][&repos=x[,y]]" | |
| - name: GAVC Search | |
| description: 'Search by Maven coordinates: GroupId, ArtifactId, Version & Classifier.' | |
| usage: | |
| method: GET | |
| path: "/api/search/gavc?[g=groupId][&a=artifactId][&v=version][&c=classifier][&repos=x[,y]]" | |
| - name: Property Search | |
| description: Search by properties. | |
| usage: | |
| method: GET | |
| path: "/api/search/prop?[p1=v1,v2][&p2=v3][&repos=x[,y]]" | |
| - name: Artifacts Not Downloaded Since | |
| description: Retrieve all artifacts not downloaded since the specified Java epoch | |
| in | |
| usage: | |
| method: GET | |
| path: "/api/search/usage?notUsedSince=javaEpochMillis[&createdBefore=javaEpochMillis][&repos=x[,y]]" | |
| - name: Artifacts With Date in Date Range | |
| description: Get all artifacts with specified dates within the given range. | |
| usage: | |
| method: GET | |
| path: "/api/search/dates?[from=fromVal][&to=toVal][&repos=x[,y]][&dateFields=c[,d]]" | |
| - name: Artifacts Created in Date Range | |
| description: Get All Artifacts Created in Date Range | |
| usage: | |
| method: GET | |
| path: "/api/search/creation?from=javaEpochMillis[&to=javaEpochMillis][&repos=x[,y]]" | |
| SECURITY: | |
| - name: Get User Encrypted Password | |
| description: Get the encrypted password of the authenticated requestor | |
| usage: | |
| method: GET | |
| path: "/api/security/encryptedPassword" | |
| - name: Get Locked Out Users | |
| description: If locking out users is enabled, lists all users that were locked out | |
| due to recurrent incorrect login attempts. | |
| usage: | |
| method: GET | |
| path: | |
| - name: Create API Key | |
| description: Create an API key for the current user | |
| usage: | |
| method: POST | |
| path: "/api/security/apiKey" | |
| - name: Get API Key | |
| description: Get the current user's own API key | |
| usage: | |
| method: GET | |
| path: "/api/security/apiKey" | |
| - name: Revoke API Key | |
| description: Revokes the current user's API key | |
| usage: | |
| method: DELETE | |
| path: "/api/security/apiKey" | |
| - name: Revoke User API Key | |
| description: Revokes the API key of another user | |
| usage: | |
| method: DELETE | |
| path: "/api/security/apiKey/{username} " | |
| - name: Revoke All API Keys | |
| description: Revokes all API keys currently defined in the system | |
| usage: | |
| method: DELETE | |
| path: "/api/apiKey?deleteAll={0/1} " | |
| - name: Security Configuration | |
| description: Retrieve the security configuration (security.xml). | |
| usage: | |
| method: GET | |
| path: "/api/system/security" | |
| - name: Save Security Configuration (Deprecated) | |
| description: Save the security configuration (security.xml). Requires the security.xml | |
| file from the same version. | |
| usage: | |
| method: POST | |
| path: "/api/system/security" | |
| - name: Activate Master Key Encryption | |
| description: Creates a new master key and activates master key encryption. | |
| usage: | |
| method: POST /api/system/encrypt | |
| path: | |
| - name: Deactivate Master Key Encryption | |
| description: Removes the current master key and deactivates master key encryption. | |
| usage: | |
| method: POST /api/system/decrypt | |
| path: | |
| - name: Set GPG Public Key | |
| description: Sets the public key that Artifactory provides to Debian and Opkg clients | |
| to verify packages | |
| usage: | |
| method: PUT /api/gpg/key/public | |
| path: | |
| - name: Get GPG Public Key | |
| description: Gets the public key that Artifactory provides to Debian and Opkg clients | |
| to verify packages | |
| usage: | |
| method: GET | |
| path: "/api/gpg/key/public" | |
| - name: Set GPG Private Key | |
| description: " Sets the private key that Artifactory will use to sign Debian and | |
| ipk packages" | |
| usage: | |
| method: PUT | |
| path: | |
| - name: Set GPG Pass Phrase | |
| description: Sets the pass phrase required signing Debian and ipk packages using | |
| the private key | |
| usage: | |
| method: PUT /api/gpg/key/passphrase | |
| path: | |
| REPOSITORIES: | |
| - name: Get Repositories | |
| description: Returns a list of minimal repository details for all repositories of | |
| the specified type. | |
| usage: | |
| method: GET | |
| path: "/api/repositories[?type=repositoryType" | |
| - name: Remote Repository Configuration (Deprecated) | |
| description: Repository Configuration (Deprecated) | |
| usage: | |
| method: GET | |
| path: "/api/repositories/{remoteRepoName}/configuration" | |
| - name: Calculate Maven Metadata | |
| description: Calculates Maven metadata on the specified path (local repositories | |
| only). | |
| usage: | |
| method: POST /api/maven/calculateMetadata/{repoKey}/{folder-path} | |
| path: | |
| SYSTEM & CONFIGURATION: | |
| - name: System Info | |
| description: System Info | |
| usage: | |
| method: GET | |
| path: "/api/system" | |
| - name: System Health Ping | |
| description: Get a simple status response about the state of Artifactory | |
| usage: | |
| method: GET | |
| path: "/api/system/ping" | |
| - name: General Configuration | |
| description: Get the general configuration (artifactory.config.xml). | |
| usage: | |
| method: GET | |
| path: "/api/system/configuration" | |
| - name: Save General Configuration | |
| description: Save the general configuration (artifactory.config.xml). | |
| usage: | |
| method: POST | |
| path: "/api/system/configuration" | |
| - name: Update Custom URL Base | |
| description: | |
| usage: | |
| method: " PUT" | |
| path: "/api/system/configuration/baseUrl" | |
| - name: License Information | |
| description: Retrieve information about the currently installed license. | |
| usage: | |
| method: GET | |
| path: "/api/system/license" | |
| - name: Install License | |
| description: Install new license key or change the current one. | |
| usage: | |
| method: POST | |
| path: "/api/system/license" | |
| - name: Version and Add-ons information | |
| description: Retrieve information about the current Artifactory version, revision, | |
| and currently installed Add-ons | |
| usage: | |
| method: GET | |
| path: "/api/system/version" | |
| IMPORT & EXPORT: | |
| - name: Import Repository Content | |
| description: Import one or more repositories. | |
| usage: | |
| method: 'POST:' | |
| path: "/api/import/repositories" | |
| - name: Import System Settings Example | |
| description: Returned default Import Settings JSON. | |
| usage: | |
| method: 'GET:' | |
| path: "/api/import/system" | |
| - name: Full System Import | |
| description: Import full system from a server local Artifactory export directory. | |
| usage: | |
| method: 'POST:' | |
| path: "/api/import/system" | |
| - name: Export System Settings Example | |
| description: Returned default Export Settings JSON. | |
| usage: | |
| method: 'GET:' | |
| path: "/api/export/system" | |
| - name: Export System | |
| description: Export full system to a server local directory. | |
| usage: | |
| method: 'POST:' | |
| path: "/api/export/system" | |
| SUPPORT: | |
| - name: Create Bundle | |
| description: Create a new support bundle. | |
| usage: | |
| method: POST | |
| path: "/api/support/bundles/" | |
| - name: List Bundles | |
| description: Lists previously created bundle currently stored in the system. | |
| usage: | |
| method: GET | |
| path: "/api/support/bundles/" | |
| - name: Get Bundle | |
| description: Downloads a previously created bundle currently stored in the system. | |
| usage: | |
| method: GET | |
| path: "/api/support/bundles/{bundle-name}" | |
| - name: Delete Bundle | |
| description: Deletes a previously created bundle from the system. | |
| usage: | |
| method: DELETE | |
| path: "/api/support/bundles/{bundle-name}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment