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
- 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"
}
- 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"
}'