如何在API url中递增一个值?

问题描述 投票:-1回答:1

我有一个带有偏移值和限值的API,valueString requestUrl = 。https:/url/offset=0&offset=1000。;this will fetch first 1000 details.I need some more details and for that I need to send the API multiple times.say for example I need execute this API 5 times and offset value should change for the first time to be 1001 and limit to be 2001How can we implement this in a generic method in java.

api limit offset
1个回答
0
投票

我不明白你的问题出在哪里,你只需要这样做。

x = 1000;
x += 1000;
url = "https://url?offsetStart=" + (x - 1000) + "&offsetEnd=" + x;

对于一个API,你可以有2个相同的参数,比如 "offset",试试 "offsetStart "和 "offsetEnd"

© www.soinside.com 2019 - 2024. All rights reserved.