---
title: "Modify YACC settings programmatically"
canonical: "https://support.appfire.com/space/YACC/152928544/Modify%20YACC%20settings%20programmatically"
format: markdown
---
> Macro (aura-html)

YACC settings can be fetched and modified via the Bitbucket REST API, as [documented here](https://docs.atlassian.com/bitbucket-server/rest/7.4.0/bitbucket-rest.html#idp367). For example,

## Fetching the YACC settings for a repository

### Pre-receive hook settings:

`curl -u admin -X GET -d "" -H "Content-Type: application/json" http://localhost:7990/rest/api/latest/projects/PROJECT_1/repos/rep_1/settings/hooks/com.isroot.stash.plugin.yacc:yaccHook/settings`

### Merge check settings:

`curl -u admin -X GET -d "" -H "Content-Type: application/json" http://localhost:7990/rest/api/latest/projects/PROJECT_1/repos/rep_1/settings/hooks/com.isroot.stash.plugin.yacc:yaccMergeCheck/settings`

Where: 

- `admin` is replaced with the username for a Bitbucket administrator
- `localhost:7990` is replaced with with the hostname and port of your Bitbucket instance.
- `PROJECT_1 `and `rep_1` are replaced with the project and repository you are interested in.

> 📝 If your Bitbucket instance is served via HTTPS, update the command above to `https://` instead of `http://`.

## Updating the YACC settings for a repository

### Pre-receive hook settings:

`curl -u admin -X PUT -d @settings.json -H "Content-Type: application/json" http://localhost:7990/rest/api/latest/projects/PROJECT_1/repos/rep_1/settings/hooks/com.isroot.stash.plugin.yacc:yaccHook/settings`

### Merge check settings:

`curl -u admin -X PUT -d @settings.json -H "Content-Type: application/json" http://localhost:7990/rest/api/latest/projects/PROJECT_1/repos/rep_1/settings/hooks/com.isroot.stash.plugin.yacc:yaccMergeCheck/settings`

- These commands are the same as for fetching the settings, but use`PUT` instead of `GET`, and specifies the new settings with the `-d` flag.
- To generate `settings.json`, fetch the full YACC settings as described above and modify as needed.

## Turning YACC on or off for a repository

**To enable the YACC pre-receive hook for a specific repository:**

`curl -u admin -X PUT http://localhost:7990/rest/api/latest/projects/PROJECT_1/repos/rep_1/settings/hooks/com.isroot.stash.plugin.yacc:yaccHook/enabled`

**To disable the YACC pre-receive hook for a specific repository:**

`curl -u admin -X DELETE http://localhost:7990/rest/api/latest/projects/PROJECT_1/repos/rep_1/settings/hooks/com.isroot.stash.plugin.yacc:yaccHook/enabled`

**Where: **

- `admin` is replaced with the username for a Bitbucket administrator
- `localhost:7990` is replaced with with the hostname and port of your Bitbucket instance.
- `PROJECT_1 `and `rep_1` are replaced with the project and repository you are interested in.

**To enable the YACC merge check for a specific repository:**

`curl -u admin -X PUT http://localhost:7990/rest/api/latest/projects/PROJECT_1/repos/rep_1/settings/hooks/com.isroot.stash.plugin.yacc:yaccMergeCheck/enabled`

**To disable the YACC merge check for a specific repository:**

`curl -u admin -X DELETE http://localhost:7990/rest/api/latest/projects/PROJECT_1/repos/rep_1/settings/hooks/com.isroot.stash.plugin.yacc:yaccMergeCheck/enabled`

**Where: **

- `admin` is replaced with the username for a Bitbucket administrator
- `localhost:7990` is replaced with with the hostname and port of your Bitbucket instance.
- `PROJECT_1 `and `rep_1` are replaced with the project and repository you are interested in.

> 📝 If your Bitbucket instance is served via HTTPS, update the command above to `https://` instead of `http://`.