Search code examples
pythonartifactory

Downloading file from artifactory, using API Key for authentication


I have looked into the documentation : https://github.com/parallels/artifactory And here: https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API

But couldn't find a good example of sending a request to download a file with it's url and use API-Key for authentication.


Solution

  • You have 2 options for using the API key for authentication:

    • Basic authentication using your username and API Key
    • Using a dedicated header (X-JFrog-Art-Api) with your API Key

    For example:

    curl -uadmin:AKCp2WXCNDRsYwX8vd83KsxEnh1tMs6Qp1Dm8M7oDtA464Nz3kmjgrZRnbtJAXm2AfDEpMhfJ -ocommons-collections-3.1.jar http://localhost:8081/artifactory/jcenter/apache-collections/commons-collections/3.1/commons-collections-3.1.jar
    

    or

    curl -H "X-JFrog-Art-Api: AKCp2WXCNDRsYwX8vd83KsxEnh1tMs6Qp1Dm8M7oDtA464Nz3kmjgrZRnbtJAXm2AfDEpMhfJ" -ocommons-collections-3.1.jar http://localhost:8081/artifactory/jcenter/apache-collections/commons-collections/3.1/commons-collections-3.1.jar