Hello everyone,
I have a problem with an API call where I use JSON body to pass values. Sometimes the variables have values, and sometimes they don't. How can I exclude a variable when it has no value? For example, I want to send this when eventTypes
has values:
{ "eventTypes": [ "type1", "type2" ], "pageIndex": "<integer>", "pageSize": "<integer>" }
But when eventTypes
has no values, I want to send this:
{ "pageIndex": "<integer>", "pageSize": "<integer>" }
How to custom json body when using api call?
Database & APIs
Resolved
ask chatgpt, search docs, find solution in community
No
2
3 replies