[英]How to read X-RateLimit HTTP header from Watson API response in Java
I'm working on a Java chatbot application using the Watson Conversation Service and I want to retrieve the information about my API limit. 我正在使用Watson Conversation Service开发Java聊天机器人应用程序,我想检索有关我的API限制的信息。
API Reference states: The response to each HTTP request includes headers you can use to determine whether you are close to the rate limit: X-RateLimit-Reset: the time the current timer expires (in UNIX epoch time) X-RateLimit-Remaining: the number of requests remaining in the current time window X-RateLimit-Limit: the total number of requests allowed within the time window https://www.ibm.com/watson/developercloud/conversation/api/v1/?java#rate-limiting API参考状态:对每个HTTP请求的响应均包括可用于确定您是否接近速率限制的标头:X-RateLimit-Reset:当前计时器到期的时间(以UNIX纪元时间)X-RateLimit-Remaining:当前时间窗口中剩余的请求数X-RateLimit-Limit:时间窗口内允许的请求总数https://www.ibm.com/watson/developercloud/conversation/api/v1/?java#rate -限制
I am interested in the values for Limit and Remaining in order to generate a warning if the remaining value is lower then a particular portion. 我对“限制”和“剩余”的值感兴趣,以便在剩余值低于特定部分时生成警告。 Browsing through the code of the Java-SDK ( https://github.com/watson-developer-cloud/java-sdk/ ) I couldn't find a way to retrieve this information from the message response.
浏览Java-SDK( https://github.com/watson-developer-cloud/java-sdk/ )的代码,我找不到从消息响应中检索此信息的方法。 Is it somehow possible?
有可能吗?
Erik, I think you are right that there is no proper way to get the rate limit information using the current Java SDK. Erik,我认为您是对的,没有使用当前Java SDK来获取速率限制信息的正确方法。 You should open an issue against the Java SDK with the information you have collected above requesting this feature.
您应该针对Java SDK提出一个问题,其中包含您在上面要求此功能时收集的信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.