Closed kibernetik542 closed 4 years ago
I'm not sure what exactly you are asking?
This should work: --statuses 1 2 3
Can't convert value "1,2,3" to type 'ProjectStatus' for option --statuses. Requested value '1,2,3' was not found.
Can't convert value "1,2,3" to type 'Nullable
1' for option --statuses.
Can't convert value "1,2,3" to type 'ProjectStatus' for option --statuses.
Requested value '1,2,3' was not found.
`
I am getting this errors, 1st without nullable enum second is nullable enum.
P.S. With postman and with swagger is working fine. I mean there is no issue in api.
Are you separating with spaces or commas?
Also, looks like you're formatting your list directly here: $"{TaikunURLs.getProjects}?statuses={Statuses}"
. That's not going to work. Maybe what you want is string
and not List<string>
.
In api, I am using comma for seperation something like ?statuses=1,2,3, btw I also tried string instead of list string but it does not failed but again filtering is not worked, in case of list it is failing
The way the arguments are bound has nothing to do with the API.
I mean by default it is not possible to pass multiple arguments as query params in aspnet core api, I created QueryStringValueProvider for this and after this I used multiple values with comma seperator, postman, fiddler, swagger, curl is working fine. Just wanted to know is it possible with CLI.
Are you asking if it's possible to send a request to a web server using a CLI? That seems completely unrelated.
I am asking is it possible to send list of string using CLI
It doesn't matter if it's a CLI or not, whatever you're sending it to doesn't care where it came from.
Agree,but somehow it works in other case which I mentioned but not working in CLI, If with CLI does not matter, it is something wrong in my code which I don't know what
Either change to public string Statuses { get; set; }
and use --statuses 1,2,3
or keep this way and change await Helpers.Transformer($"{TaikunURLs.getProjects}?statuses={Statuses}");
to await Helpers.Transformer($"{TaikunURLs.getProjects}?statuses={string.Join(",", Statuses)}");
In my api I can use something like api/projects?statuses=1,2,3 it would be perfect also use this feature.
Example code: