ARTIFACTORY: Understanding the Behavior of the Artifact Latest Version Search Based on Layout REST API

ARTIFACTORY: Understanding the Behavior of the Artifact Latest Version Search Based on Layout REST API

Products
Frog_Artifactory
Content Type
REST_API
AuthorFullName__c
Jeremy Leopold
articleNumber
000006390
ft:sourceType
Salesforce
FirstPublishedDate
2025-03-25T06:41:32Z
lastModifiedDate
2025-03-24
VersionNumber
2
Overview

This article explores the behavior of the Artifact Latest Version Search Based on Layout REST API when querying for Maven snapshot versions. It examines how repository versioning settings impact artifact naming and retrieval and provides troubleshooting insights for common issues. For basic usage, please refer to our documentation.

Impact of Repository Versioning on Artifact Naming

The way artifacts are named and versioned upon deployment depends on the repository’s Maven Snapshot Version Behavior setting (Admin -> Repositories -> <Repo-Key> Basic -> Maven Settings -> Maven Snapshot Version Behavior):
  • Unique → The artifact version includes a timestamp appended to the artifactId specified in pom.xml.
  • Non-unique → The artifact follows the standard X.X.X-SNAPSHOT naming convention, where the artifact ID is combined with the version from pom.xml.


API Behavior Based on Repository Versioning


Scenario: No Artifacts with X.X.X-SNAPSHOT Naming (deployed with Unique snapshot setting)
If no artifacts exist with the standard X.X.X-SNAPSHOT naming convention, the API request returns a 404 Latest integration version not found error:

curl -u admin:password "http://<JFROG_HOST>/artifactory/api/search/latestVersion?g=com.example&a=demo2&v=*SNAPSHOT*"

{
  "errors": [
    {
      "status": 404,
      "message": "Latest integration version not found"
    }
  ]
}


In contrast, when the Unique snapshot version is specified, the result is the latest integration version:

curl -u user:password -X GET "http://localhost:8082/artifactory/api/search/latestVersion?g=com.example&a=demo&repos=omerb-sts-snapshots-mirror&v=1.0-SNAPSHOT"

1.0-20220406.094243-3% 



Scenario: Artifacts Deployed with Non-Unique Snapshot Setting
When artifacts are deployed with the Non-Unique snapshot setting, the API returns the expected latest version:

curl -u admin:password "http://<JFROG_HOST>/artifactory/api/search/latestVersion?g=com.example&a=demo2&v=*SNAPSHOT*"

1.0-SNAPSHOT


The screenshot below demonstrates this behavior, showing one repository with Non-Unique snapshot versioning and another with Unique snapshot versioning:

 

User-added image 

Troubleshooting: API Returns "Latest Integration Version Not Found" Despite Existing Artifacts


In some cases, the API may return a 404 Latest integration version not found error even when artifacts with the X.X.X-SNAPSHOT naming convention exist. This issue can often be resolved by deleting and regenerating the metadata file.
The screenshot below illustrates the metadata file:

User-added image 

Conclusion

  • The repository's Maven Snapshot Version Behavior setting significantly affects how the Latest Version Search API retrieves snapshot artifacts.
  • If artifacts do not follow the X.X.X-SNAPSHOT naming convention, the API may return a 404 error.
  • Deleting and regenerating the metadata file can resolve unexpected API errors.