简体   繁体   English

连续休息请求未带来更新数据

[英]Consecutive Rest request doesn't bring updated data

Working with the ZenDesk Rest API (some ticket management software), I have the functionalities of listing tickets and creating new ones. 使用ZenDesk Rest API (一些票务管理软件),我可以列出票证并创建新票证。

Here's the scenario: 这是场景:

  1. GET tickets; 获得门票;
  2. Create a new ticket; 创建一个新票证;
  3. GET tickets again (and show them in a grid); 再次获取票证(并在网格中显示);

On step one, say 20 tickets are returned. 在第一步中,说返回20张票。 On step 3, the same 20 tickets are returned. 在步骤3中,将返回相同的20张票证。 After a while though, the request brings the 21 expected tickets. 过了一会儿,请求带来了21张预期的门票。

Here's some code: 这是一些代码:

public JObject GetTicketsByUserEmail(string userEmail)
{
    var client = new RestClient(RequestUri);
    client.Authenticator = new HttpBasicAuthenticator(Username, Password);
    string resource = "/api/v2/search.json?query=type:ticket tags:" + userEmail;
    var request = new RestRequest(resource, Method.GET);
    client.AddDefaultHeader("Accept", "application/json");
    request.Parameters.Clear();
    request.RequestFormat = DataFormat.Json;

    IRestResponse response = client.Execute(request);
    var content = response.Content;

    client.Execute(request);

    JObject jObject = JObject.Parse(content);

    return jObject;
}

The above works fine, bringing the tickets as expected. 上面的工作正常,带来了预期的门票。 After creating a new one, I can see on ZenDesk's web application the newly created ticket. 创建新票证后,我可以在ZenDesk的Web应用程序上看到新创建的票证。

The above code is then run again but it doesn't bring the new ticket to the .Net code, despite existing on the ZenDesk portal! 上面的代码然后再次运行,但是尽管ZenDesk门户网站上已有它,也不会将新票证带到.Net代码! So the list that is shown to the user is refreshed but doesn't show him the ticket he just created. 因此,显示给用户的列表会刷新,但不会显示给他刚创建的票证。

Well, since I can see the new ticket on the ZenDesk portal, I'm guessing the Rest request on the .Net side is somehow not refreshing or using old data, I don't know. 好吧,因为我可以在ZenDesk门户上看到新的票证,所以我猜.Net端的Rest请求在某种程度上不刷新或使用旧数据,我不知道。

I need to return the new updated data with newly created records in it. 我需要返回包含新创建记录的新更新数据。

Their support team provided the answer to this. 他们的支持团队提供了答案。

Since I'm retrieving my tickets using their Search method instead of the Tickets one (because I want to filter my results), the results retrieved aren't immediately updated, as they alert in their documentation : 由于我是使用票务的Search方法而不是Tickets方法来获取Tickets (因为我想过滤我的结果),因此检索到的结果不会立即更新,因为它们会在其文档中发出警报:

Note: It can take up to a few minutes for new tickets, users, and other resources to be indexed for search. 注意:新的票证,用户和其他资源可能需要花费几分钟才能被索引以进行搜索。 If new resources don't appear in your search results, wait a few minutes and try again. 如果新资源未出现在搜索结果中,请等待几分钟,然后重试。

So, after creating a new ticket, it is actually created but not immediately indexed for search, which means a Search call that is made right after a ticket creation won't contemplate that new record. 因此,在创建新票证之后,实际上会创建该票证,但不会立即为其索引以进行搜索,这意味着在创建票证后立即进行的Search调用不会考虑该新记录。

The time that takes to index the new records isn't fixed or possibly calculated. 索引新记录所需的时间是固定的,也可能无法计算。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Groupby 和 selectMany 和 orderby 不会带回我需要的数据 - Groupby and selectMany and orderby doesn't bring back the data I need 提交表单不会带走所有数据 - Submitting form doesn't bring over all the data Rest API 数据不删除 - Rest API data doesn't delete LogicalCallContext不会在HttpApplication BeginRequest事件和其余请求之间流动吗? - LogicalCallContext doesn't flow between HttpApplication BeginRequest event and the rest of the request? Firebase REST API - 使用id令牌验证请求不起作用 - Firebase REST API - authenticating request with id token doesn't work POST 操作后视图不显示更新的数据 - View doesn't show updated data after POST action REST WCF服务不适用于内部数据 - REST wcf service doesn't work with data inside 在数据网格视图中更新数据时,组合框数据源绑定不显示文本 - Combo box data source binding doesn't show text when data is updated in data grid view 为什么此Linq查询不能带回不同的(唯一的)结果? - Why doesn't this Linq query bring back distinct (unique) results? .Net控制台应用程序无法启动控制台 - .Net Console Application that Doesn't Bring up a Console
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM