What is your way to get the fields information when using Services 3 I have a registration form with 50+ input fields. What is the best way to get form filed information to pass it to iPhone or Android developers to make a form in the mobile app?

Currently i am doing something like inspect the form with firebug and copy/paste the form to make this work. 

Recently i have written some code to get the form field information. 

This is the idea.


In the hook_formalter add a $form['#after_build'][]
Get the keys in $form['#after_build'][] and get the basic information.
Render the information to a item and add it to form so that i can copy/paste


But its not perfect; when the form fields like add custom modules for Registration like Logintoboggan etc i am not getting expected results. 

What is your way to do it?

This is the result i expect in case of a select field

  Array
         (
                [Title] =&gt; Marital Status
                [Field Name] =&gt; field_marital_status[und]
                [Type] =&gt; select
                [Options] =&gt; Array
                    (
                     [151] =&gt; Status
                     [154] =&gt; -Divorced
                     [155] =&gt; -Married
                     [153] =&gt; -Never married before
                     [157] =&gt; -Separated
                     [156] =&gt; -Widowed

                    )

       )
As @Clive has suggested in comment its best to write your own service resource for this. 

Approach 1:

But i wouldn't bother to programaticality supply the form field values anymore.  Reason being, its usually not cost-effective to spend enough hours trying to figure out every possible field type that has been implemented or may be implemented in the future.

Instead create an API documentation. The implementation details is the liberty of IPad / Android dudes. Make sure you enable version control over the docs and also maintain a well documented change logs.

Approach 2:

If you do want to supply the form field information via services. 

Then create a resource action. 

Something like www.mysite.com/your-endpoint-name/your-resource-name/get-form 

This action should be responsible to provide the field details.

This could be done by calling drupal_get_form($form_id); and then passing the $form array through a function that would filter out lots of unnecessary data which drupal adds.

Please note that the main difference here is "We are removing unwanted data from the form definitions" instead of "adding necessary field data".  Thus it will help reducing missing fields that might be added later by some modules in to the form.

After you are done with removing you may add additinal information into the form array like API interface Version, timestamp, and some default values that maybe useful for the Ipad/android dudes.