jenkinsbuildjenkins-apibuild-environment

Jenkins JSON API - Locate Build, Build Environment, and Build Trigger API data


I am working with the Jenkins API JSON.

I understand the format to retrieve API data in JSON

<Jenkins_URL>/job/<job_name>/api/json

Within the job/<job_name>/configure UI we can configure/add Build triggers, build env, and build data.

I want to be able to view the Build, Build Env, and Build Triggers data in a JSON API.

Is it even possible to get said data? What are alternative ways to get all available data that is found in the configure page of a job?


Solution

  • I think the most straightforward way is to access <Jenkins_URL>/job/<job_name>/config.xml.

    Yes, it's not JSON, but you can be sure that this contains everything that was configured on the configuration page.

    The XML file is the "native" serialized version of the Job configuration. The JSON API will always require some additional glue that may exist or not exist.