Modifying access permissions to a project

Please read this before posting

  • If you received an error from the API that you’re looking for help with, please include the error in your post and be descriptive of the requests you made that received the errors. To be clear, we need the error in the JSON response from the API, not the error your code raised.
  • Do not share any API credentials. Please check that the code you’re pasting into the post does not contain any real OAuth tokens or personal access tokens. If you have exposed credentials, you should revoke them immediately.

I am the owner of a project and I have added several users with the default permissions (“can edit”) which allows them to accidentally make modifications to my project. Rather than modify each user’s permissions individually, I’m thinking of writing a shell script that uses curl to change the permissions of several users to “commenters”. I tried the following command but I get back an error with a very unhelpful message (“Not Found”). What, if anything, am I doing wrong?

Note: I have replaced personal data (GIDs, API tokens) with generic text between <<>>.

curl --request PUT \
     --url https://app.asana.com/api/1.0/memberships/<<membership_gid>> \
     --header 'authorization: Bearer <<my_api_token>>' \
     --header 'accept: application/json' \
     --header 'Asana-Enable: new_memberships' \
     --header 'content-type: application/json' \
     --data '{"data": {
  "member": "<<member_gid>>",
  "parent": "<<project_gid>>",
  "resource_type": "membership",
  "resource_subtype": "project_membership",
  "standard_access_level": "commenter" }}'

@sasha_f you are the master of this endpoint, and I am a bit lost to be honest with the aborted migration.