Skip to content

Instantly share code, notes, and snippets.

@JogoShugh
Created September 16, 2019 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JogoShugh/e8ad1c01b89ac7adaadb374562a94550 to your computer and use it in GitHub Desktop.
Save JogoShugh/e8ad1c01b89ac7adaadb374562a94550 to your computer and use it in GitHub Desktop.
Manager Members by API IdeaSpace reply

I want to let you know that we've been working on this.

We are implementing this within our "bulk" api, which supports JSON or YAML input.

You will be able to do commands like this, for example:

Assign a single member to a Project, using OID Tokens for Member and Role:

POST /api/asset:

JSON version:

  {
    "from": "Scope:1003",
    "execute": {
      "op": "AssignMemberWithRole",
      "args": {
        "Member": "Member:1234",
        "Role": "Role:9",
        "IsOwner": false
      }
    }
  }

YAML version:

from: Scope:1003
execute:
  op: AssignMemberWithRole
  args:
    Member: Member:1234
    Role: Role:9
    IsOwner: false

Assign MULTIPLE members to a Project using a SubQuery to identify the Member and the Role (this makes it so that you don't have to maintain a cumbersome list of OID Tokens but can specify the match via friendlier search terms like Username or Name, etc.

JSON version:

  {
    "from": "Scope:1003",
    "execute": {
      "op": "AssignMemberWithRole",
      "list": [
        {
          "Member": {
            "from": "Member",
            "where": {
              "Username": "member1"
            }
          },
          "Role": {
            "from": "Role",
            "where": {
              "Name": "Role.Name'Customer"
            }
          },
          "IsOwner": true
        },
        {
          "Member": {
            "from": "Member",
            "where": {
              "Username": "member2"
            }
           },
          "Role": {
            "from": "Role",
            "where": {
              "Name": "Role.Name'Customer"
            }
          },
          "IsOwner": false
        }
      ]
    }
  }

YAML version:

from: Scope:1003
execute:
  op: AssignMemberWithRole
  list:
  - Member:
      from: Member
      where:
        Username: member1
    Role:
      from: Role
      where:
        Name: Role.Name'Customer
    IsOwner: true
  - Member:
      from: Member
      where:
        Username: member2
    Role:
      from: Role
      where:
        Name: Role.Name'Customer
    IsOwner: false

Note that, as of now, the SubQuery will only utilize the FIRST result. But, we will also be introducing a reciprocal operation on Member called "AssignProjectWithRole" in which you could identify N members by as complicated a query as you like and then assign them all to the same Project (as long as you're wanting them all to have the same role)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment