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

XMLWordPrintable

    • 0
    • 1

      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=(",", ": ")))
      

       

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

              Created:
              Updated: