Legacy Dev Forum Posts

 View Only

Sign Up

Sporadic API response issues

  • 1.  Sporadic API response issues

    Posted 06-05-2025 18:14

    Mike.Chavez | 2019-04-09 18:20:25 UTC | #1

    I am having issues with the API endpoints not returning data sporadically now that I am testing in our staging environment. I did not encounter any of these issues when working locally. Most of the time the response is simply empty. This is affecting most of the endpoints we are trying to hit, the most common endpoints we are using is the conversations details (GET /api/v2/analytics/conversations/{conversationId}/details )and get conversation recordings (GET /api/v2/conversations/{conversationId}/recordings).

    The very odd thing is that if I use the API explorer it works however when our server tries, it will arbitrarily return nothing even with the exact same data. I believe it may be possibly related to credentials because if I force getting a new token this will fix the issue for a few minutes, but then starts acting up again. The other oddity is that if I manually run the exact commands in a server console it will mostly return fine (it is hard to recreate manually), but pretty reliably returns nothing when done automatically by the server code. Again this all worked fine on a local server, but is not working now that is in a staging environment in Heroku.

    For context we are using the Web Data Actions to create logs/events in our server during both pre-call and wrap-up. We send the interaction id to our server which then requests the info via the endpoints. We are running a Ruby on Rails server hosted on Heroku and storing our token in Redis, renewing when it expires. We have manually implemented the API via RestClient instead of using the Ruby Gem for PureCloud. Some information is performed immediately when we get the action, some is backgrounded to Sidekiq, but both are having issues.

    This is completely halting us from transitioning to using PureCloud as this logging/event tracking is required.

    Ruby on Rails - 4.2.11 Ruby - 2.4.5 Redis - 3.3.5 Sidekiq - 5.2.5


    tim.smith | 2019-04-09 18:42:33 UTC | #2

    Mike.Chavez, post:1, topic:4952
    Most of the time the response is simply empty

    If you're referring to analytics query responses, analytics will only return data if there is data that matches the interval and filter. For GET /api/v2/analytics/conversations/{conversationId}/details specifically, that one should always return data as long as the conversation id is valid.

    Mike.Chavez, post:1, topic:4952
    The very odd thing is that if I use the API explorer it works however when our server tries, it will arbitrarily return nothing even with the exact same data. I believe it may be possibly related to credentials because if I force getting a new token this will fix the issue for a few minutes, but then starts acting up again.

    Are you possibly suppressing error responses? It sounds like maybe you're creating too many tokens for the came client credentials and the older token is getting invalidated. That would result in a 403 response. Can you grab a correlation ID from a working request from your service and a correlation ID from a request after it starts failing? You can find it in the response headers.

    As a matter of best practice for client credentials, the OAuth client you're using for your service shouldn't be used anywhere else so that you don't accidentally invalidate tokens being used by the service. If you have multiple services, create multiple OAuth clients. For testing locally or running it in other places, create a separate OAuth client.


    system | 2019-05-10 18:42:35 UTC | #3

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 4952