tec
tec

Reputation: 35

how to build web api parameter dynamically

I need to call a webAPI with string array as a parameter.

I have a string array . I need to call this api from c#

string[] str;
str[0]= "abc";
str[1]= "xyz";

how can I create the api request call like given below.

http://localhost:59511/api/Values?str[]="abc"&str[]="xyz"

Upvotes: 0

Views: 145

Answers (1)

Craig H
Craig H

Reputation: 2071

You can format the request like so:

http://localhost/api/values?str=abc&str=xyz

Upvotes: 1

Related Questions