<p>You should use of the <a href="https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API#ArtifactoryRESTAPI-RetrieveLatestArtifact" rel="nofollow noreferrer">Retrieve Latest Artifact</a> endpoint. It uses the <a href="https://www.jfrog.com/confluence/display/RTF/Repository+Layouts" rel="nofollow noreferrer">repository layouts</a> to know what is the version in your artifact path, so you want to make sure those are set right for you. In this case, it's a standard Maven layout, which is the default for Maven repo, so you're all good.</p>

CC BY-SA 4.0
2019-01-15T22:38:34.423Z
2019-01-15T22:38:34.423Z
JBaruch
<p>There is a static Artifactory URL being used to grab a semantically versioned artifact and deploy it to JBoss.  The deployment aspect of the cookbook is already fleshed out.  However, I would like to make the URL "dynamic".  In other words, get the most recently published artifact from Artifactory.</p>

<p><strong>Example URL</strong>
<a href="https://myartifactory.com/releases/com/package/helloworld/1.0.0/helloworld-1.0.0.war" rel="nofollow noreferrer">https://myartifactory.com/releases/com/package/helloworld/1.0.0/helloworld-1.0.0.war</a></p>

<p>A Jenkins pipeline exists for this artifact that deploys to Artifactory.  So, if 1.1.0 were to be released, it's URL would look like the following:</p>

<p><strong>1.1.0 URL</strong>
<a href="https://myartifactory.com/releases/com/package/helloworld/1.1.0/helloworld-1.1.0.war" rel="nofollow noreferrer">https://myartifactory.com/releases/com/package/helloworld/1.1.0/helloworld-1.1.0.war</a></p>

<p>You can see that the directory in Artifactory changes, as well as the name of the artifact.  How can I set up the cookbook to always grab the latest version from Artifactory?</p>

CC BY-SA 4.0
2018-12-03T15:56:29.070Z
From artifactory [documentation](https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API#ArtifactoryRESTAPI-RetrieveLatestArtifact), replace your static version number by `[RELEASE]` to get the latest release.
Tensibai
<chef><artifactory><curl>
Cookbook get and set dynamic URL
firesalsa
# Cookbook get and set dynamic URL

(Asked by: username_0 on 2018-12-03)

There is a static Artifactory URL being used to grab a semantically versioned artifact and deploy it to JBoss. The deployment aspect of the cookbook is already fleshed out. However, I would like to make the URL "dynamic". In other words, get the most recently published artifact from Artifactory.

**Example URL**
<https://myartifactory.com/releases/com/package/helloworld/1.0.0/helloworld-1.0.0.war>

A Jenkins pipeline exists for this artifact that deploys to Artifactory. So, if 1.1.0 were to be released, it's URL would look like the following:

**1.1.0 URL**
<https://myartifactory.com/releases/com/package/helloworld/1.1.0/helloworld-1.1.0.war>

You can see that the directory in Artifactory changes, as well as the name of the artifact. How can I set up the cookbook to always grab the latest version from Artifactory?

**Tags:** chef, artifactory, curl

> **Comments:**
> **username_1**: From artifactory [documentation](https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API#ArtifactoryRESTAPI-RetrieveLatestArtifact), replace your static version number by `[RELEASE]` to get the latest release.  

---

## 1 answers

### Answer by username_2 on 2019-01-15. Score: 1

You should use of the [Retrieve Latest Artifact](https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API#ArtifactoryRESTAPI-RetrieveLatestArtifact) endpoint. It uses the [repository layouts](https://www.jfrog.com/confluence/display/RTF/Repository+Layouts) to know what is the version in your artifact path, so you want to make sure those are set right for you. In this case, it's a standard Maven layout, which is the default for Maven repo, so you're all good.


---

