-
Notifications
You must be signed in to change notification settings - Fork 1
REST API
Ensure that you have access to an Artifactory service, and that you have access to a repository where you have read/write permission within that Artifactory service before you begin.
⚠️ It is highly recommended that you are always verifying Artifactory's CA Certificate. See the CA Certificates wiki if your Artifactory service uses an internal/self-signed SSL certificate to learn how to include the CA Certificate associated with your internal/self-signed SSL certificate in your HTTP/REST calls to Artifactory using curl to verify the certificate.
Ensure that you have an artifact to upload to Artifactory, and that you have access to a repository where you have write permission in Artifactory.
You do not have to generate checksums for your artifacts, but it is highly recommended that you do. Generating checksums for your artifacts before uploading them to Artifactory enables Artifactory to verify that the artifact that it receives is the same exact one that you uploaded. Matching checksums are an indication that both artifacts are identical. This is an additional layer of security that ensures that nothing happened to the artifact in transit. See the JFrog Checksums documentation for more details.
- From a command prompt, ensure that you are in the directory where the artifact you want to upload to Artifactory lives.
- Use a hash generation utility to generate a SHA1, SHA256, and MD5 checksum for the the artifact that you want to upload to Artifactory.
- Generating Checksums on Windows, Mac, and Linux
-
Generating Checksums on the z/OS file system:
-
SHA1:
USERNAME@MACHINE ~ > sha1 <file name>
-
SHA256:
USERNAME@MACHINE ~ > sha256 <file name>
-
MD5:
USERNAME@MACHINE ~ > md5 <file name>
-
SHA1:
-
Ensure that you are in the directory where the artifact that you want to upload to Artifactory lives.
-
Use the following template to upload an artifact WITHOUT checksums. ❌ (Not recommended)
$ curl -u <username>:<password> \
> -T <name of file you want to upload> \
> "http://<artifactory host/ip>/artifactory/<repository>/<desired artifact name>"
- Use the following template to upload an artifact WITH checksums. ✔️ (recommended)
$ curl -u <username>:<password> \
> -T <name of file you want to upload> \
> -H "X-Checksum-Sha1:<SHA1 checksum for file you want to upload>" \
> -H "X-Checksum-Sha256:<SHA256 checksum for file that you want to upload>" \
> -H "X-Checksum-Md5:<MD5 checksum for file that you want to upload>" \
> "http://<artifactory host/ip>/artifactory/<repository>/<desired artifact name>"
Ensure that you have an artifact in Artifactory to download, and that you at least have read permission for the repository where that artifact lives in before you begin.
- Ensure that you are in the directory that you want to download the artifact from Artifactory to.
- Use the following template to download the artifact:
$ curl -u <username>:<password> \
> -O "http://<artifactory host/ip>/artifactory/<repository>/<artifact name>"
This section explains how to get the metadata associated with an artifact stored in Artifactory. The main reason you might want to do this is because the artifact's checksums are included in this metadata. Therefore, you can generate checksums for the artifact after you download it, and then compare the checksums you generated to the ones included in the metadata to verify that nothing happened to the artifact in transit. Matching checksums indicate that the downloaded artifact is identical to the corresponding artifact that is stored in Artifactory.
- Use the following template to get the metadata about the artifact that you just downloaded:
$ curl -u <username>:<password> \
> -I "http://<artifactory host/ip>/artifactory/<repository>/<artifact name>"
This section explains how to use the two authentication methods that one can use to Authenticate with Artifactory using Artifactory's REST API directly.
-
Username/Password authentication is used in all of the previous examples using
-u <username>:<password>
.
$ curl -u <username>:<password> \
> -T <name of file you want to upload> \
> "http://<artifactory host/ip>/artifactory/<repository>/<desired artifact name>"
- You may want to use API Key authentication instead of Username/Password authentication with Artifactory for a number of reasons (e.g. Increased security). You can authenticate with Artifactory using an API Key by removing the
-u <username>:<password>
, and replacing it with-H "X-JFrog-Art-Api:<your api key>"
. For more details on API Keys and how to generate them, see the API Keys wiki.
$ curl -H "X-JFrog-Art-Api:<your api key>" \
> -T <name of file you want to upload> \
> "http://<artifactory host/ip>/artifactory/<repository>/<desired artifact name>`
- Home
- Getting Started
- Artifactory Setup:
- Using Artifactory:
-
zCX Production:
- Databases:
- SSL-TLS:
- Additional Considerations