Using 2 OAuth clients at the same time

I know we can raise a Genesys case to increase to number of max API calls per OAuth client (keeping in mind the max remains 10 x 300 per minute) but I just need this ad hoc extra horse power so I tried to use 2 Oauth client but it does not work (no increase at all).

  1. Normally we use this to hardcode the apiclient for all APIs
    Configuration.setDefaultApiClient(apiClient);

  2. Now i used this API with apiclient as the input like this:
    RecordingApi recordingApi = new RecordingApi();
    RecordingApi recordingApi2 = new RecordingApi(apiClientSecond);
    With this anything invoked with recordingApi will use the default (apiClient) and anything called with recordingApi2 will use apiClientSecond. the 2 API clients are different OAuth clients in the same ORG (different clientId and clientsecret)

Am I doing something wrong here? The output was exactly the same as before, i was distributing the API calls over the 2 recording API instances i created above.

I also tried this but no change, same speed
Configuration.setDefaultApiClient(apiClient);
....
RecordingApi recordingApi = new RecordingApi();
Configuration.setDefaultApiClient(apiClientSecond);
RecordingApi recordingApi2 = new RecordingApi();

Has anyone used 2 API clients to temporarily speed up a process? I would love to troubleshoot this but the SDK debug hides the auth header so i dont know exactly which Oauth client is being used for the queries.

If you intend to use multiple auth tokens in the same app (i.e. multi-tennanting), you need to manage your ApiClient instances and never use the default one. Pass the appropriate ApiClient instance into the constructor for the API category class. This feature is used extensively by our testing department.

You can use the SDK's logger to log extended information. I believe it should show this.

Hi Tim,
I have removed the Configuration.setDefaultApiClient(apiClient) command completely and initalized the API endpoints with the 2 separate api clients (both authenticated successfully). It works well but i dont see any improvement in completion time.
I have this logic:

  1. apiclients authenticated successfully:
  • apiclient (clientid1, clientsecret1, same ORG)
    -apiclient2 (clientid2, clientsecret2, same ORG)
  1. I have 2 recordingsAPI created using the above 2 api clients
    RecordingApi recordingApi = new RecordingApi(apiclient);
    RecordingApi recordingApi2 = new RecordingApi(apiclient2);

  2. now i update 196 conversations in for cycle:

  • get conversation metadata with the first:
    recordingApi.getConversationRecordingmetadata();
  • make some conversation updates with the other one:
    recordingApi2.putConversationRecording();

All steps are successful, updates happen as expected but the complition time is slightly over 2 minutes in both cases, no improvement
You said you are using this and actually it works well but the capacity is not doubled, it remains the same. is there any chance the API gateways responsible for the rate limit somehow sees it is the same client generating the traffic? For example it is the same IP and the same TCP session even though the oauth client token belongs to different OAuth clients.
thanks,
Zsolt

I meant using the ApiClient constructors, not changing "capacity".

Can you provide a description of the problem you're actually having? It sounds like maybe you're being rate limited, or maybe your download speed is slow? If you are reporting being rate limited, can you provide correlation IDs and response bodies for being limited on each auth token?

Hi Tim,
i have ran a simplified test and i was able to see both api clients were maxed out (300 calls before being rate limited). my previous tests "failed" (didnt complete fast enough) because I did not use enough test data, rate limiting didnt actually kick in as such the tests run roughly the same time.
thanks,
Zsolt

1 Like