I have this kind of sample code below that calls an API using get method:
CrudService.getAll("sampleurl/param1/param2/param3");
From that sample, param1 and param2 can be null/blank value. What happens is that the value of param3 goes to param1 when it comes to the API Controller.
How can I maintain the right values for the parameter even if there can be several null/blank values? TIA.
CrudService.getAll("sampleurl/param1/param2/param3");
You have to pass a dummy value for param1 so if param1 is empty keep it "param1". various possible call based on empty params :
("sampleurl/param1/param2/2");
("sampleurl/param1/3/2");
("sampleurl/param1/param2/param3");
So when the call goes to API, check there is param1=param1 ignore the value you have to keep 3 values in order to match the signature of API in any case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With