How to fetch field names of forms

How to fetch field names of forms

  

Hi,

I have a form. The form has various fields. And on Submission of a form I am making a REST API call which will append the field names to the URL and the API will return responses on the basis of parameters( field names in this case) sent. Isn't there any way by which I could fetch field names dynamically from the form without me appending it manually to the URL. The objective is if in the future if I  add more fields to my form, there shouldn't be any need to update the API Request. 

Any suggestion?  

Hi Shashankit,

It depends a bit what you mean by "field names". The names as seen in Service Studio are only used design-time, they're not available in runtime. The only thing coming close are Widget Ids, but they are not stable and not guaranteed to look like or contain the Name of the Widget.

I'd be interested to know the use case though, it seems you have a very generic REST Method that accepts a list of key/value pairs? Why is it set up like this?

Hi Kilian,

By Field name I mean the label name that I have given to my input fields.

The REST API that I'm consuming is a GET method which accepts field names in it's URL and returns responses for the appended fields.

Example:-https//xyz.pq/dev/name,address...

Hi Shashankit,

Label names are totally independent of the actual values, and are subject to translations etc., so you definitely can't use them.

As for the REST API, it looks weird. REST APIs should be designed to point to resources, and definitely shouldn't have field names in their paths (instead, use search variables). Is it one you designed or an external one?