-
Type:
Suggestion
-
Resolution: Unresolved
-
None
-
Component/s: API - REST
-
None
-
1
It is not possible to use the REST API to get a list of all uploaded hook scripts that are not yet associated with any project or repository. If a customer didn't write down the script ID after uploading it and before it is associated with any project or repository, there is no REST API endpoint to retrieve the ID of that script.
Workaround
- Iterate through projects and repositories and use REST API endpoints to retrieve a list of scripts associated with them. This is not feasible when there are many projects or repositories.
- Get hook scripts associated with the project: https://developer.atlassian.com/server/bitbucket/rest/v819/api-group-project/#api-api-latest-projects-projectkey-settings-hooks-get
- Get hook scripts associated with the repository: https://developer.atlassian.com/server/bitbucket/rest/v819/api-group-repository/#api-api-latest-projects-projectkey-repos-repositoryslug-hook-scripts-get
- Check the file system directory <BITBUCKET_HOME>/shared/config/hook-scripts/.
There should be files named SOMENUMBER-0 inside that directory; the "SOMENUMBER" part is the script ID. - Use the database query to get a list of all uploaded hook scripts:
select * from bb_hook_script;