Hello everyone, I'm having a hard time resolving this issue. Maybe one of you experience the same.I'm consuming an API which I use for updating data. I tried to debug (see picture for reference) to see the request I am sending,(please focus on the isActive attribute). I check the isActive in my request which is False. I expecting a value of False in the response, because I sent the correct request for it.But when the API respond, the isActive attribute value become true.
weird part is also I check it on service center in monitoring>integrations with full logging. It shows in the request that there is no isActive attribute.
Hi RD,
I think you already given the answer yourself
"It shows in the request that there is no isActive attribute. "
and
" he said that default value of the isActive in there end is true. "
The default on Outsystems end is False, and the option 'Send Default Value' on the attribute is standard off, meaning that if OS sees the value of False, it will not add it in the body. That works ok as long as everybody agrees that default is false.
With external api's, safest would be to also send the default values, or alternatively, adjust on your end the default to true to reflect the api's producers default, which is true.
Dorine
A bit offtopic but alas. I have bad experience with sending default values because this could also imply a deliberate value. That could be something else in the target systems that possible could work with null values. IsActive could be True/False or Null where Null implies that no decision has been made. This goes especially wrong with lists where adding no list (null) results in a different behavior then sending an empty list (could remove all references to an item for example).
Hello Dorine,
Yes there is no isActive attribute sent when I check it in Outsystems service center, but in the debugger (please see image above) the Request sent is complete with isActive = false, and that is the question for me.It is clear in the debugger that the Request is complete, but in service center, the isActive is missing. Also the default value in API dev side is already removed.
but, let me try changing the Send default value to "Yes" if it will work.
Hello Dorine, changing the Send Default Value to "Yes" works! The Request in service center now is sending the isActive value. Thank you!
Agreed, though OS can't distinguish between not sending the default value of a boolean and not sending the boolean at all. If the receiving API expects a tri-state (True, False or null), you're screwed anyway...
We can safely presume that something is happening at the consumed API that cause the IsActive to become True. This could be the expected behavior of this API but that this is simply not known or well documented.
Have you access to that API? Can you debug it? If it is out of you control then my first step would to raise a support ticket to get assistance in solving this issue.
Hello Vincent, I tried the API I consumed in Postman, and its working fine, the isActive attribute is also changing.
I also communicated it with developer of the said API, he said that default value of the isActive in there end is true.
Hello RD
Your JSON key name and Structure attribute key name (Name in JSON) should be exactly same.
It is case sensitive.
In your case it is IsActive and Isactive both are different.
Your name in JSON of structure attribute should be "Isactive" or Attribute name should be "Isactive"
Give it a try and let me know if this helps.
Thanks & regards
Anees
I will try this and give you an update. Thank you
Hello Vincent, its still the same after I did what you said. I also doubt it because I observe the other attribute names in my request and in response, they are also different in casing but the update is showing correctly, just the isActive are not updating. Also ask the API developer to remove the default value in there end, still not solve the issue. Also tried to reconsume the API and nothing happen.
I recommend you to apply debugger at OnBeforeRequest of your API and check the structure of the request. Also share me that screenshot.
Because here that attribute is missing.
Best regards
Is see that IsActive = True right there;
Is this perhaps the default value of your API structure? And are you sending default values (configurable setting)?
his problem was with false not being sent (as that is the default on OS side), and the other side assuming it is true (as that was their default)
Bad default, btw :)