How to create and deploy a build info JSON file via the REST-API?

There is a private REST-API call to deploy build-info files to Artifactory, so you will be able to generate a build info JSON file (same as the plugin generates for your builds).

 

The REST-API query for deploying the build info file should look like the following:

curl -X PUT -u<username>:<password> -H “Content-type: application/json” -T buildtest.json “http://host:8081/artifactory/api/build”

 

Since this is a private query, it’s not in our documentation. However, we can give you the basics here.

Generally, the minimum for a valid build info JSON file is the version, name, number and started date.

The most basic one with the above params + module and artifact should look like the following example:

{

“version” : “1.0”,

“name” : “myBuild”,

“number” : “129”,

“started” : “2014-03-31T16:24:42.116+0300”,

 

“modules” : [ {

“id” : “org.jfrog.test:multi:2.36-2-SNAPSHOT”,

“artifacts” : [ {

“type” : “pom”,

“sha1” : “a1ab9222c219ec885ce4374b77cc4bd93485c6c8”,

“md5” : “495a5e916f0e308a8ed4fc170e4d9136”,

“name” : “multi-2.36-2-SNAPSHOT.pom”

} ]

} ]

}


For more complicated builds, you might want to review your current build info files and create one with the same structure (dependencies etc..). 

Note: The “number” value must be unique for that build name, or you will receive a 500 error.