Hi there,
I cannot manage to send URL parameter if parameter is null while doing test in the OS; for non null it is okay. My question is how to send the null as url parameter value?
regards and thanks
Hi,
Those array lists in url parameters are typically represented in the following way
?parameter=["key1","key2","key3"]
Looking at the stripe documentation than the lookup_keys is an optional parameter. That means you either send it with values or not at all. You do not send a null.
OutSystems does not support Arrays as Url parameters directly but there is an easy way to do it.
Create an input url input parameter LookupKeys and bind it to your method e.g. /prices?lookup_keys={LookupKeys}. Make sure that both mandatory and send default value is set to No.
Create a wrapper service action with an input parameter LookupKeys with a data type of List of Text.
Add a local variable LocalLookupKeys with data type text
Add an If statement with a condition of not LookupKeys.Empty. In the true branch add a Serialize JSON action and serialize the input parameter LookupKeys. Then assign the result of the serialized value to LocalLookupKeys.
Use the LocalLookupKeys as parameter for the REST query.
This should do it.
Stefan
Thank u, Sir
All the syntaxes of this kind: ?parameter=["key1","key2","key3"]
does not work on Test Tab, i tried combination like [{Key1},{key2}], {[key1,key2]}, etc
and the only one that properly works is something like this:
https://api.stripe.com/v1/prices?lookup_keys[0]={lookup_key}&lookup_keys[1]={lookup_key1}
For the action code, i haven't tried your suggestion, i'll try it later if there's the case.
For the null case, yes could be Stripe does not return the results for condition is null. I try also putting %00 with no luck in the Test of Service Studio.
regards
What data type does the parameter have?
Hi thanks,
It is a string
Hi Ibox,
Have you tried passing empty quotes "".
Regards
Krishnanand Pathak
yes, but with no luck
Hi @ibox ,
I'm curious to know that why you used '[]' in query parameter - lookup_Keys[]
Will this query parameter hold list or single line string only?
Best
Arun
Yes, that's the way to send member of arrays:
This is for one member, you can also put index in there lookup_keys[0] with same result.
if there are more then one member then we must put the indexes lookup_keys[0] = {lookupkey}&lookup_keys[1] = {lookupkey1} and i tried succeed for non null.
Did you try it on postman or swagger with null value?
Or can I also try this curl at my end? as it's stripe api and I have worked on stripe payment gateway?
Hi ibox,
I have tried doing the same thing. It is working for me with "" and with null as well.
You can try with this API.
https://personal-uketk5va.outsystemscloud.com/DemoRef/rest/Movies/GetMovies?Title={Title}
Can you double-check the datatype of the parameter?
Thanks,
Neha
I have already double checked -I hit the REST API of Stripe payment gateway-.
For empty string:
If i list all, there's the null:
Have you tried setting Send default values as "Yes" ?
Regards,
Please check REST API setting where accept default value property should be YES.
Thanks
Shradha
It is Test tab, no option for that.
Hi, here you can check
Hi @ibox
the reason why it is not working in the test tab is because the parameters are not url encoded using the test tab. They are sent as presented. URL encoding is only done when you call the consume action from code. So in your case your would have to encode the ["key1","key2"] part before using an online encoder
your call in the test tab would then look like this
/restcall?lookup_keys=%5B%22key1%22%2C%22key2%22%5D