0

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.

Dharma Raj
  • 11
  • 2
  • 1
    I believe this should help you. https://stackoverflow.com/questions/3061273/send-an-array-with-an-http-get?answertab=active#tab-top – Felipe Saggion Feb 07 '18 at 09:44
  • Possible duplicate of: [Send an Array with an HTTP Get](https://stackoverflow.com/questions/3061273/send-an-array-with-an-http-get) – DJDaveMark Feb 07 '18 at 12:50

1 Answers1

0

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
synthet1c
  • 6,152
  • 2
  • 24
  • 39