Search code examples
attask

AtTask API - Creating access rules with the "share" operation


I'm trying to use the following URI to add EDIT access to a team on a project:

https://mysite.attask-ondemand.com/attask/api/v4.0/project/54983c34002ee72d8e3869b29dcaa625/share?method=PUT&sessionID=0096e9b9f1cc4471b911c7a49b917cec&accessorID=53bb2da40003442310e8946bff9ce324&accessorObjCode=TEAMOB&coreAction=EDIT

This seems to follow the form specified in the API docs, but it's giving me the error APIModel V4_0 does not support share operation. The API docs specifically say to use v4.0 in the URI, so why am I getting this error? Is something else wrong with the URI?


Solution

  • Currently there is no action named 'share' for projects in AtTask API. That's why your code doesn't work.

    As an alternative way, you can first get all accessRules of your project, add new accessRule object to received array and then edit your project (PUT method) to apply new array of accessRules.

    To get all accessRules make a call to:

    https://mysite.attask-ondemand.com/attask/api/v4.0/project/54983c34002ee72d8e3869b29dcaa625?fields=accessRules:*
    

    In a response you will get an array of ACSRUL objects under accessRules key. Add new object to that array:

    {
        objCode: 'ACSRUL',
        securityObjID: '54983c34002ee72d8e3869b29dcaa625', //your project
        securityObjCode: 'PROJ',
        accessorID: '53bb2da40003442310e8946bff9ce324', //team to be shared with
        accessorObjCode: 'TEAMOB',
        coreAction: 'EDIT',
        secondaryActions: [],
        forbiddenActions: []
    }
    

    Then update your project (see Nested Updates)

    PUT /attask/api/project/54983c34002ee72d8e3869b29dcaa625?updates= 
    {
        accessRules: [ ... ] //array of access rules
    }