Search code examples
restartifactory

Is there an Artifactory API call that creates a folder?


What am I missing here? I'm using the Create Directory API call because I want to create a directory. What ends up happening with this is that it creates a file with the name that I've specified.

myrepostore.jfrog.io/artifactory/<parentDirectory>/<newDirectory> is the syntax where newDirectory should be the directory that I'm attempting to create with this PUT method.


Solution

  • To create a folder using the Artifactory REST API, you should indicate your intention by adding a forward slash at the end of the folder name in the API endpoint. This helps Artifactory understand that you want to create a folder rather than a file.

    Example:

    curl -u<username>:<password> -XPUT "http://my.jfrog.artifactory:8081/artifactory/generic-local/a/"
    

    This will upload a directory called 'a' under an existing repository generic-local of type 'Generic'

    Note: The generic-local should exist prior to adding the sub folder.