简体   繁体   中英

How to pass an array within a query string in http GET method?

How to pass the array values in Query String using http GET method?

http://localhost:3011/api/latest/os/archive/catalogue?Labels=[ {Label: Name of Label-1},{Label: Name of Label-2}]&CatalogueID=101&ArchivePolicyID=122

if, passing these values, how to get array values, using key or index values.

You can create an array in a url using array assignment eg. things[]=zero&things[]=one which will look like things = ["zero", "one"] on the server.

You also need to assign an associative array with things[][label]=value which will be picked up on the server as things = [{label: "value"}]

http://localhost:3011/api/latest/os/archive/catalogue?Labels[][label]=Name%20of%20Label-1&Labels[][label]=Name%20of%20Label-2}]&CatalogueID=101&ArchivePolicyID=122

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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