[ When an Artifactory/Edge cannot connect to a Mission Control ]

How can I attach a license from a License Bucket to an Artifactory using REST APIs?

AuthorFullName__c
Joshua Han
articleNumber
000004546
ft:sourceType
Salesforce
FirstPublishedDate
2019-09-28T03:36:21Z
lastModifiedDate
2020-07-12
VersionNumber
8

Please bear in mind that it is the best practice to add the Artifactory/Edge to Mission Control, so you may easily track and manage usage and licenses. Use of the same license in multiple instances is a violation of the license agreement

1. Add license buckets to a Mission Control via REST APIs or via UI
2. Obtain Licenses

<With Mission Control 4.x>
Use Mission Control REST API: Acquire License to output licenses from the license bucket.

<With Mission Control 3.x>
Use Mission Control REST API: Attach License with "deploy":false to output a license from the license bucket. The JSON file that is needed for updating Artifactory licenses uses licenseKey (notice that K is uppercase) as the key, which is different than what the Mission Control REST API provides as the key (license_key). Thus, you may use a sed following command to fix this. 

For example, (note that "/mc/" in the URI is not needed if you are using the detached version of Mission Control instead of the new - combined with Artifactory)

curl -X POST -uadmin:password http://my.jfrog.platform.url/mc/api/v3/attach_lic/buckets/999748414 -H 'Content-Type: application/json' -H 'cache-control: no-cache' -d '{
"service_name" : "EdgeKansasCity",
  "deploy" : false
}' > license.json && sed -i -e 's/license_key/licenseKey/g' license.json


3. Attach licenses to Artifactory/Edge
Use the license.json to provision the license to an Artifactory node. For example, 

curl -XPOST https://my.jfrog.platform.url/artifactory/api/system/licenses -d@license.json -H "Content-Type: application/json" -uadmin:password


Below is a list REST APIs that can be used for managing Artifactory licenses :

4. For offline license install, track Sites and Licenses Manually
Make sure to provide a unique name as a service_name to help manually track the following because Artifactory is not connected to the Mission Control:

  • service_name that was used with the attach-license REST API.
  • To which Artifactory/Edge the license were manually deployed to since the license file is used only once per active node. Use of the same license in multiple Artifactory violates license usage agreement.
[ Detach Licenses ]
When releasing a license to a License Bucket, you will need the service_name for when detaching the license back to the license bucket using Detach License REST API.

<With Mission Control 4.x>
Use Release License REST API

<With Mission Control 3.x>
Use Detach License REST API as below
DELETE /api/v3/detach_lic/bucket/{BUCKET NAME} with following JSON
{
  "service_name" : "{ServiceName}"
}
For example, (note that "/mc/" in the URI is not needed if you are using the detached version of Mission Control instead of the new - combined with Artifactory)
curl -X DELETE -uadmin:password \
https://my.jfrog.platform.url/mc/api/v3/detach_lic/buckets/edge \
-H 'Content-Type: application/json' \
-d '{
  "service_name" : "my-edge-in-kansas"
}'