Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-19508

Add the available parameters on REST API endpoints (Create/update a hook script)

XMLWordPrintable

    • 0
    • We collect Bitbucket feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      API documentation is missing parameters, specifically talking about the PUT endpoint to Create/update a hook script: 
      https://developer.atlassian.com/server/bitbucket/rest/v805/api-group-repository/#api-api-latest-projects-projectkey-repos-repositoryslug-hook-scripts-scriptid-put

      Please add the "-u user:password as an available parameter. Example:

      curl -u user:password--request PUT \
        --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts/{scriptId}' \
        --header 'Accept: application/json' \
        --header 'Content-Type: application/json' \
        --data '{
        "triggerIds": [
          "<string>"
        ]
      }'

      The Python code is missing an important parameter :

      headers=self.HEADERS,
      auth=(USER, TOKEN)

      example

      # This code sample uses the 'requests' library:
      # http://docs.python-requests.org
      import requests
      import json
      
      url = "http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts/{scriptId}"
      
      headers = {
        "Accept": "application/json",
        "Content-Type": "application/json"
      }
      
      payload = json.dumps( {
        "triggerIds": [
          "<string>"
        ]
      } )
      
      response = requests.request(
         "PUT",
         url,    
         headers=self.HEADERS,
         auth=(USER, TOKEN) )
      
      print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))
      

       

              Unassigned Unassigned
              a40e482b6993 Samuel de Azevedo Dias
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: