-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage Records API isn't working well #2302
Comments
Following on to this, the responses are a bit of a mess. It appears that the returned category is always calls, but the data is not for calls. Also, the documentation is not right on the public site. The category documentation says to use the lower case enum values, but you have to use the actual ENUM values to get it to work. |
Also, if you don't specify a category it only returns the calls category. |
@mithileshkarnati @scottbarstow we definitely have some problems with this. Anyway, I wanted to point out that, as for latest Restcomm-Connect release, on the lowercase issue, if instead of executing:
you issue the command like this:
you don't get the
The problem is that if you issue the same command but with sms instead of calls as value for "Category", you get the same result. So, we have two issues here:
|
@FerUy It's actually a combination of things. Yes, the category always says calls, but the data changes based on category. It appears the data is correct, but the category label is wrong. And, as I said above, if you do not specify category, only calls data is returned. I tried a number of options and in many cases the results were unexpected / wrong. |
@scottbarstow true, we are in the same page... today you'll have more news on this as part of current research. |
For the categories issue, the problem is that the following:
within Then, following Then, we need to fix that in the usage endpoint. |
@scottbarstow commit 5cd90d2 solves the problem @mithileshkarnati reported in the first place. For example, after applying this very simple patch, and executing the following commands (having only records for calls and 0 for SMS), the results are the following: For calls or CALLS (works for XML also, only showing json executions here):
For SMS or sms (in this case showing XML, works for json too):
We still need to enhance the documentation of the API, but strictly for the issue reported by @mithileshkarnati, this simple patch solves it. One warning (and should be part of the documentation, is that as how the Usage Records API is implemented, issuing the command in the following way will not work now (for this we should refurbish the API current implementation quite a bit):
So, if you agree I can make the pull request for fixing the issue reported here only with previous commit, and proceed to enhance the documentation. |
@FerUy Does this change fix the issue with other categories still displaying "Calls" in the response? Seems like it would but just confirming. And what about the issue with not specifying a category. Do we now get all categories? Not sure what's expected there. |
Yes, for example (works identical whichever you use uppercase or lowercase for sms/SMS):
Good catch, reason for b421efc. Now if you don't specify the category it works identical to what @mithileshkarnati reported in the first place, i.e. "fine". Anyway, again, this simple fix focused on reported concerns between calls/sms category (or none) and gives a quick fix for just that. The Usage Records API, IMHO, should be enhanced/refurbished. |
Agree that it needs more work, but if this fixes the immediate stuff. |
Right @scottbarstow, it does. After assessing the current state of the API, I focused in fixing the urgent problem reported initially by @mithileshkarnati, as otherwise it would take more time for both implementing the complete refurbishing as well as posterior peer reviewing. |
@scottbarstow my bad for previous answer, I initially misunderstood your question and tested incorrectly (on the rush). On a further thought and reviewing this, I generated not only calls but messages (SMS) and these are a couple of responses when querying calls and sms (either in lowercase or uppercase, same result)...
Which is consistent with what really happened (I really carried out 13 calls):
Also consistent with the fact that I really generated 2 messages (SMS): But, we are still displaying "calls" in the response for the "category" field when retrieving SMS records. So, the answer to the question is, not yet. Reported HTTP Status 500 errors are gone, when category is set to a value either in uppercase or lowercase it returns the answer corresponding to that category, but category is always set to calls in the response, even if it corresponds to messages records, which is obviously not correct. Likewise, when not setting the category in the query, it returns the same as if it was set to calls. In other words, we are in better shape than before, we are discriminating the responses accordingly to the category, but still not good enough. I will withdraw pull request #2578 for now. |
…s is used in the Endpoint. Issue #2302
…calls and SMS records. Issue #2302
…s is used in the Endpoint. Issue #2302
When we execute the general GET request to the API,
curl -X GET https://AC13b4372c92ed5c07d51cf842e2664ff:7bec2769d3b48e9132e596b60a558d65@cloud.restcomm.com/restcomm/2012-04-24/Accounts/AC13b4372c92ed5c07d951cf842e2664ff/Usage/Records/Daily.json
Its working fine but when we use Filters like
curl -X GET https://AC13b4372c92ed5c07d51cf842e2664ff:7bec2769d3b48e9132e596b60a558d65@cloud.restcomm.com/restcomm/2012-04-24/Accounts/AC13b4372c92ed5c07d951cf842e2664ff/Usage/Records/Daily.json?Category=calls
Its returning a server error,
HTTP Status 500 - No enum constant org.restcomm.connect.dao.entities.Usage.Category.calls
This problem is getting fixed when we use
curl -X GET https://AC13b4372c92ed5c07d51cf842e2664ff:7bec2769d3b48e9132e596b60a558d65@cloud.restcomm.com/restcomm/2012-04-24/Accounts/AC13b4372c92ed5c07d951cf842e2664ff/Usage/Records/Daily.json?Category=CALLS
But when we use a similar command like
curl -X GET https://AC13b4372c92ed5c07d51cf842e2664ff:7bec2769d3b48e9132e596b60a558d65@cloud.restcomm.com/restcomm/2012-04-24/Accounts/AC13b4372c92ed5c07d951cf842e2664ff/Usage/Records/Daily.json?Category=SMS
We are getting a response whose,
"category": "calls"
BUT "uri": "/2012-04-24/Accounts/AC13b4372c92ed5c07d951cf842e2664ff/Usage/Records/Daily.json?Category=sms&StartDate=2017-06-29&EndDate=2017-06-30"
I think a "category": "sms", if present, should be returned
The text was updated successfully, but these errors were encountered: