我正在尝试在我的应用程序中使用 RestAssured 调用 SAP SF API 调用。该服务的参数为 top 1 。
RestAssured.baseURI="https://sandbox.api.sap.com/successfactors/odata/v2/PerGlobalInfoCHN?%24top=1";
RequestSpecification httpPost = RestAssured.given().headers("ApiKey","*key*");
Response response= httpPost.request(Method.GET);
String responseBody = response.getBody().asString();
System.out.println("Response Body is :"+response.getBody().prettyPrint());
输出应该只是一个顶级元素,但我得到了所有结果。当 postman 中给出相同的 URL 时,它只返回前 1 个。这里有什么问题?我们是否必须在标题中提供 top=1 作为参数?