Querying Data in Pages
Procedure
The following uses the API (GET /v2/{project _id}/elb/loadbalancers) as an example to describe how to query all five load balancers and associated resources by page. Two load balancers are displayed on each page.
- Set the header information in Postman, put the obtained token in the header, set limit to 2, and query load balancers on the first page.
Figure 1 Page 1
- Check whether the number of load balancers returned is less than the value of limit. If yes, the last page is displayed. If no, the next page will be queried. In this example, to query the next page, set marker to the ID of the last load balancer on the previous page, set limit to 2.
Figure 2 Page 2
- Use the same method to query the third page.
Figure 3 Page 3
- If the number of load balancers on the previous page is less than the value of limit, the pagination query is complete.
Sample Code
The request body in 2 is as follows:
GET https://elb.cn-north-1.myhuaweicloud.com:443/v2/e2e095f1a31c467c89d4251cae136fa1/elb/loadbalancers?limit=2&marker=42aa24dd-32f7-482d-8612-6a4a23320457
The response body in 2 is as follows:
{ "loadbalancers": [ { "id": "84328656-33c6-431b-ac86-e876219e1aa7", "name": "ulb-vg7d", "description": "21212", "provider": "vlb", "listeners": [ { "id": "8bad548d-740f-44db-bc91-c10271a0c750" } ], "pools": [ { "id": "bc632a6f-b691-4f07-8523-2c4c7009d28e" }, { "id": "599a4c5b-c00c-4491-9860-f322200c72a3" } ], "tags": [], "tenant_id": "e2e095f1a31c467c89d4251cae136fa1", "project_id": "e2e095f1a31c467c89d4251cae136fa1", "vip_subnet_id": "0d11891d-92b3-4a89-af39-fad71c6481a7", "vip_port_id": "475890b6-2e31-440b-a2a7-907a71d62c3b", "vip_address": "192.168.40.191", "provisioning_status": "ACTIVE", "operating_status": "ONLINE", "admin_state_up": true, "created_at": "2018-10-11T14:11:19", "updated_at": "2018-11-07T07:38:54", "enterprise_project_id": "0" }, { "id": "992fd704-1e38-4975-a04a-a4e7982146de", "name": "ulb-8yrd", "description": "", "provider": "vlb", "listeners": [ { "id": "ad49e548-1466-43de-9247-10f56e1f2e0e" }, { "id": "bdba3fa8-574f-4c6e-a808-8f21b54b9b1a" } ], "pools": [ { "id": "10977afc-dfb9-40fa-afa5-2177aa8f8529" }, { "id": "18238c04-5b33-4e5c-8069-8728dece4b54" }, { "id": "5389884f-e884-4c98-9e5f-1b8da5cb3fd0" } ], "tags": [], "tenant_id": "e2e095f1a31c467c89d4251cae136fa1", "project_id": "e2e095f1a31c467c89d4251cae136fa1", "vip_subnet_id": "f15e603b-49d3-4b4d-9a26-1f24ea20d443", "vip_port_id": "3421dbcd-5d25-4cb0-b472-e9dfca260bf6", "vip_address": "192.168.0.29", "provisioning_status": "ACTIVE", "operating_status": "ONLINE", "admin_state_up": true, "created_at": "", "updated_at": "", "enterprise_project_id": "0" } ] }
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot