简体   繁体   English

向API发出连续的GET请求

[英]Make consecutive GET requests to API

I'm making a GET request to a URL which responds with a JSON object which has more URLs inside. 我正在向一个GET请求发送一个URL,该请求以一个包含更多URL的JSON对象作为响应。 the URLs inside the response I also need to make a GET request to, i'm wondering if there's a faster/alternative way to speed it up. 我也需要向GET请求发送响应中的URL,我想知道是否有更快/替代的方法来加快它的速度。

Currently it works like this - 目前,它的工作方式如下:

Make request to URL1 > find URL2 in response > make request to URL2 > find URL3 in response > make request to URL3 and so on..... 向URL1发出请求>在响应中找到URL2>向URL2发出请求>在响应中找到URL3>向URL3发出请求,依此类推.....

it seems slow because the requests are one after the other. 这似乎很慢,因为请求是一个接一个的。

The first response I get is like this 我得到的第一反应就是这样

{
    "href": "URL1",
    "date": "*******",
    "message": "Test",
    "displayDepartment": true,
    "recipients": [
        {
            "href": "URL2"
        }
    ],
    "nominator": {
        "href": "notneeded"
    },
}

I'm making the requests in C# and looking for a way to make a request to URL1 and at the same time make a request to URL2 which is in the first ones response. 我正在用C#发出请求,正在寻找一种向URL1发出请求的方法,同时向第一个响应中的URL2发出请求。

That seems like a design decision of your API. 这似乎是您API的设计决定。 If there is no call to get all urls at once or all objects with one request, then I don't see a chance to improve your process. 如果没有调用一次获取所有URL或一次请求获取所有对象的电话,那么我看不到有机会改善您的流程。 Don't worry about style or reviews. 不必担心样式或评论。 If the API is given, there is nothing you can do. 如果提供了API,则您无能为力。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM