This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Octane Rest API permission denied : Issue with deleting an entity of type "scm_branch"

Hello everyone,

I am an SDET and currently working with the REST API in Python/Postman. I have been able to perform a PUT operation with an HTTP REST API call to a particular endpoint.
I created a pull request with 2 branches, then deleted the pull request using the UI, but I am unable to delete the branches with the UI or with HTTP requests.

I am trying to delete an entity of type "scm_branch". However, when I try to do so, I receive an error message saying "Current user is not authorized to perform this operation." The error message indicates that I do not have the necessary permissions to perform this operation.

I would like to know what permission level is required to delete an entity of type "scm_branch". Are there any settings or switches that I need to activate in order for this to work?

Here's the code that I used to try to delete the branch:


/api/shared_spaces/27001/workspaces/6001/scm_branches => 

{"total_count":2,"data":[{"type":"scm_branch","workspace_id":6001,"id":"1001"},{"type":"scm_branch","workspace_id":6001,"id":"1002"}],"exceeds_total_count":false,"total_error_count":0}

def createPullRequests(payload,Cookies):
    urlRelation='https://'+server+':'+port+"/api/shared_spaces/"+shared_space+"/workspaces/"+workspace+"/analytics/ci/pull-requests"


    payload = json.dumps(payload)
   
    headersRelation = {
        'content-type': "application/json",
        'accept': "application/json",
        'ALM_OCTANE_TECH_PREVIEW': 'true',
        'hpeclienttype': "HPE_MQM_UI"
        }

    responseRelation = requests.request("PUT", urlRelation, data=payload, headers=headersRelation, cookies=Cookies, verify=False)

    print(responseRelation.text)
    return responseRelation
#createPullRequests(payload,Cookies)


def delete_branch(cookies ,branch_id):
    headers = {
        'content-type': "application/json",
        'accept': "application/json",
        'ALM_OCTANE_TECH_PREVIEW': 'true',
        'hpeclienttype': "HPE_MQM_UI"
        }
   
    delete_url = 'https://'+server+':'+port+"/api/shared_spaces/"+shared_space+"/workspaces/"+workspace+"/scm_branches/1001"
   
    response = requests.delete(delete_url, headers=headers,cookies=cookies, verify=False)
   
    if response.status_code == 204:
        print(f"La branche {branch_id} a été supprimée avec succès.")
    else:
        print(f"Erreur lors de la suppression {delete_url}de la branche {branch_id} : {response.text}")
delete_branch(Cookies ,'1001')

Error message : 
"description":"Current user is not authorized to perform this operation.","description_translated":"User <Octane Python Wrapper> does not have enough permissions to perform <delete> operation on resource <scm_repository>.","properties":{},"business_error":true}

Thank you in advance for your help.

  • 0  

    Hi 

    Deletion of this entity is not supported currently.

    If you see this as an important functionality, please post an idea on the Idea Exchange.


    Yael Peisachov

    OpenText ValueEdge and ALM Octane Functional Architect