Best answer

How to manage optional fields in API call

  • 28 January 2024
  • 2 replies
  • 20 views

Hello,

I try to connect the Gravity Form from my wordpress website to one API of the government.

I don’t know how to manage the fields that are optional in the API.

 

"NomUsage" for example. It is a name. If user write in this field on my Gravity Form, no problem, this is written in the API call : "NomUsage" : "Nameofuser"

 

But if the user writes nothing in Gravity Form, this is written in the API call : "NomUsage" : "" and the API return an error because it expects the line to be removed.

 

Could you please help me ?

 

Thanks a lot !

 

icon

Best answer by Troy Tessalone 28 January 2024, 20:19

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Userlevel 7
Badge +14

Hi @Glomaro 

You may need to add custom Code logic to configure the API data JSON structure so it is dynamic.

Code: https://zapier.com/apps/code/help

Hi Troy,

 

Thanks a lot for your answer, I’ll try that.