Update configuration file

Updates the configuration file content. The configuration file content must be a valid YAML string, representing a dictionary object.

The file_sha parameter is required to ensure the file being updated has not changed since the last read operation. If the file has changed, the update will fail to prevent overwriting changes. To forcefully update the configuration file content, you may provide a commit hash in the file_sha parameter.

Important: This API overwrites the entire configuration. Please call the Get configuration file API to retrieve the current configuration content first, and append the new configuration to the existing content.
For details on the structure of specific configurations, please refer to the Security As Code Documentation.

Usage Example

  1. Retrieve the current configuration content using the get configuration API:
curl -X GET \
  –url https://api.jit.io/plans/configuration-file \
  –header ‘accept: application/json’ \
  –header ‘Authorization: Bearer ’

A potential response might be:

{
  "content": {
    "folders": [
      {
        "exclude": [
          "/tests/*"
        ],
        "path": "/"
      }
    ]
  },
  "sha": "c548d1f6410fa66f1222678eef84a26dd042fc0f"
}
  1. Update the configuration file content:

For instance, to add a new exclude folder to the current content, append it and use the following curl command:

curl -X PUT \
  –url https://api.jit.io/plans/configuration-file \
  –header 'accept: application/json' \
  –header 'Authorization: Bearer ' \
  –data '{
  "payload": {
    "folders": [
      {
        "exclude": [
          "/tests/*",
          "/cypress/*"
        ],
        "path": "/"
      }
    ]
  },
  "file_sha": "c548d1f6410fa66f1222678eef84a26dd042fc0f"
}'

Requires the following permission:
jit.preferences.write

Body Params

New configuration file content and file SHA

string

The SHA-1 hash of the content prior to updating, used to prevent overwriting changes.

Updates will be rejected if the content has been modified since the last read operation.

payload
object
required

The configuration file content, more info can be found in the Security As Code Documentation.

For example {"folders": [{"exclude": ["/tests/*"], "path": "/"}]}

string

The commit message to be used when updating the configuration file.

Responses

Language
Credentials
Bearer
JWT
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json