Http Request Limits
# support
c
We are primarily using bundles for data migration but for one part of our data we initially decided it wasn't worth moving to bundles, but now that I'm actually attempting a migration of this data I got the throttled error. What are the limits? Per second? Per minute? Trying to see if I can use some simple sleeps to not rework everything, or if I need to bundle up. Thanks!
r
do you have a sample bundle that fails (test data)? Will try to get to the bottom of it.
c
Hi @reshma , we didn't go down the bundle route for this originally, was trying to just do straight requests, looks like I need to update it.
r
I do think that some combination of sleeping or using multiple hosts to connect will be the right path
c
Thank you!!!
Follow-up question I'm getting an error that is confusing, I find it hard to believe I've hit rate limit after 15-20 seconds and I'm seeing two different errors. I get this whether I try to do a .search or .searchOne of resource type encounter/clinical impression, etc. It doesn't like my custom identifiers, however it works in the admin app and via graphql.
c
Hi @codejenn Our server rate limiter only applies to /auth/ and /oauth2/ routes. This usually indicates a client that is attempting to reauthenticate per-API call. Or, if using
MedplumClient
, that the app is creating new instances of the client. The most direct ways to fix: 1. If using
MedplumClient
, try to reuse a single instance to preserve auth state 2. Use client credentials flow, and cache and reuse the access token. (i.e.,
await medplum.startClientLogin(clientId, clientSecret)
, and
medplum.getAccessToken()
) 3. Use basic auth, which does not hit rate limited endpoints (i.e.,
medplum.setBasicAuth(clientId, clientSecret)
> It doesn't like my custom identifiers Hm, it looks like
twilioddt
is ending up as a URL query string key rather than a value the URL should be something like
Encounter?identifier=MY_VALUE
If using the
MedplumClient
search methods, you can either: 1. Pass that in as a string:
medplum.search('Encounter', 'identifier=MY_VALUE');
2. Or pass it in as an object:
medplum.search('Encounter', {identifier: MY_VALUE });
Feel free to reach out if you'd like a more detailed response on any of this!
c
Thank you @cody ! It shouldn't be creating any new clients or re-authing. We set a client once and then use it to call the sdk methods. This is on a node service we are attempting to use with migrations. Appreciate the feedback, I'll try a few more things!
161 Views