question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make it easier for a user of the API to add members to groups

See original GitHub issue

At this time the Vinyl API expects a user to pass in ids to the member and admin fields.

{
  "name": "some-group",
  "email": "test@example.com",
  "description": "an example group", 
  "members": [
    {
      "id": "2764183c-5e75-4ae6-8833-503cd5f4dcb0"
    }
  ],
  "admins": [
    {
      "id": "2764183c-5e75-4ae6-8833-503cd5f4dcb0"
    }
  ]
}

When using the API there doesn’t seem to be a way to look up users like you can with the portal. Its not possible for me to get the ID for Alice so I can send her ID in the payload. I can grab IDs from the browser traffic but that’s not API friendly.

2 solutions I have in mind are:

  • expose an api endpoint to look up users by name. I can then get their id and use it to create groups.
/api/users/lookupuser/alice100
  • change the group create payload to accept name instead of id . When you receive the name you could do a look up behind the scenes like the portal
{
  "name": "some-group",
  "email": "test@example.com",
  "description": "an example group", 
  "members": [
    {
      "id": "alice100"
    }
  ],
  "admins": [
    {
      "id": "alice100"
    }
  ]
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
remerlecommented, Sep 8, 2020

@pauljamescleary this is adding the reverse lookup username->id. This can, and probably should, be done together with #930.

I was hesitant with this one because it allows for discovering which users exist in the system. However, since this is behind auth, that discovery is possible already through the portal. We need to be sure, though, that we only expose the id. I don’t want to leak any info about the user other than the fact that their username has an id in VinylDNS.

1reaction
remerlecommented, Sep 4, 2020

This goes hand-in-hand with #930. I think we should provide an endpoint that simply returns the ID of a user given the username. We already support adding any user to a group by username in the portal.

Similar to #930, we should have an endpoint GET /users/<username> which returns id and username.

{
  "id": "<user_id>",
  "username": "<username>"
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Manage developer accounts using groups in Azure API ...
Associate groups with developers · Select the Groups tab to the left of the screen. · Select Members. Add a member · Press...
Read more >
Group and project members API - GitLab Docs
Documentation for GitLab Community Edition, GitLab Enterprise Edition, Omnibus GitLab, and GitLab Runner.
Read more >
REST API design: how to represent users joining and ...
Doing this through /groups resource seems a management task (e.g admins removing users from groups) rather than someone leaving or joining a ...
Read more >
New users' group problem when created via API v3
Hi all! I'm tying to create a new user with api v3 (/rest/api/3/user) without any group. When a make a POST request, a...
Read more >
Adding Users to Group via the API
To do this with by group/user names require a scripted rest api (preferably). Other wise you will need to have your business logic...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found