Skip to content

Latest commit

 

History

History
39 lines (21 loc) · 922 Bytes

manage_apikeys.md

File metadata and controls

39 lines (21 loc) · 922 Bytes

Manage User Api Keys

  • Create artifactory client

      from artifactory import Artifactory
      artifactory = Artifactory(
              url="http://127.0.0.1:8081",
              username="admin",
              password="password",
              )
    
  • Fetch api key for logged in user

      apikey = artifactory.security.apikeys.fetch()
    
  • Create api key for logged in user

      apikey = artifactory.security.apikeys.new()
      apikey.api_key = "my-key"
      apikey = apikey.create()
    
  • Revoke api key for logged in user

      response = artifactory.security.apikeys.revoke()
    
  • Revoke api key for other users (admin only)

      response = artifactory.security.apikeys.revoke("first.last")
    
  • Required/optional fields

      print apikey.required
      print apikey.optional