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.

[QUESTION] Support both /users/{user_id} and /users/_bulk

See original GitHub issue

I have /users API that supports PUT and GET for /users/{user_id}. Now I want to introduce a bulk API to update several users at once. I thought about introducing /users/_bulk endpoint for PUT operations - we don’t allow _ in our IDs hence there is no URL collision.

However when trying to implement it in FastAPI they do collide and /users/_bulk gets routed to /users/{user_id}.

In our old system we use aiohttp which stores routes just a a list. Hence, to solve the above “collision” we just sort routes as

paths = sorted(paths, key=lambda x: x.count("{"))

which effectively pushes more vague, pattern routes down the list.

Do you think it will be a valid request for FastAPI to do the same?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
haizaarcommented, Jan 19, 2020

/CC @motinani, @worroc

Hi @tiangolo, I moved to new place where I’m not involved with FastAPI anymore. I’d like to once again express my deep gratitude to you for creating this amazing project!

2reactions
haizaarcommented, May 22, 2019

Found the reason why it seemed to work regardless of the order - by accident I defined bulk endpoint as /users/_bulk/ with trailing / while /users/{user_id} without.

Such a waste of everyone’s time 😐

Thank you @euri10 and @tiangolo for looking into this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bulk create users in Azure Active Directory - Microsoft Learn
In Azure AD, select Users > Bulk create. On the Bulk create user page, select Download to receive a valid comma-separated values (CSV)...
Read more >
How do I enable or disable products for multiple users (bulk ...
Select Select all < # > to select all users in your account. · Select specific users manually. · Use the "Filter category"...
Read more >
Assign tokens to multiple users bulk mode
I have several service accounts and need to assign multiple tokens to each one. Is there a bulk update way to do that?...
Read more >
Manage users | Bulk CSV upload - Adobe Support
How to manage multiple users. This article covers the following: Add users by CSV; Edit user details ...
Read more >
Create Bulk Users in Active Directory (Step-By-Step Guide)
Below is the PowerShell command to get all domain users. ... In addition, it supports advanced options that are difficult to code with ......
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