Home > Software engineering >  Artifactory API to upload directory with contents
Artifactory API to upload directory with contents

Time:01-24

I was looking into the Artifactory REST API doc but I could not find any API that allows us to upload a directory with contents (can be files, subdirectory). There is only API to upload an individual file. I also found this where it stated that it can be done through GUI or the JFrog CLI. I wonder if I misread some documents and if there actually is a way to do that with the REST API.

CodePudding user response:

In order to upload (a.k.a "deploy") a directory with its contents via REST API you can use the Deploy Artifacts from Archive endpoint.

You'll need to create an archive file (zip, tar, tar.gz) with the directory and its contents, and call the upload API with the target folder, specifying the X-Explode-Archive: true request header.

E.g. (simplified - omitted auth, etc.):

curl -X PUT https://jfrog.foo.bar/artifactory/my-repo-local/   \
     -H "X-Explode-Archive: true"                              \
     -T my-file.tar.gz
  • Related