confusedandamused
confusedandamused

Reputation: 756

Kentico GET Form Data

I am currently trying to use the Kentico API to gather the data from all forms within Kentico.

So far I've found that there are two places to view form data and they can be found at these endpoints:

/rest/cms.forms <---- Returns all form definitions (excluding field data types

/rest/bizformitem.bizform.FORM_NAME/ <---- Returns all form data (inserted by end users)

What I am trying to do is keep a record of all of the form data on a daily basis. Is there a better way to do this using the API rather than making 'x' number of calls (one per form).

EDIE: Out of 100+ forms I only need to pull 15-20 of them on a daily basis.

Upvotes: 0

Views: 412

Answers (2)

Roman Hutnyk
Roman Hutnyk

Reputation: 1549

There is Kentico API (not a REST API) that allows you to get all data you need at code behind. You can find examples here.

Upvotes: 0

Peter Mogilnitski
Peter Mogilnitski

Reputation: 998

You can get all in sql and it depends how many forms you have. Each form is separate sql table that has a record in CMS_Class table

-- this will give the list of all tables that you need query

select ClassTableName  from CMS_Class where ClassIsForm = 1  

Then you can find out the ones that were updated let say with in the 24 hrs

SELECT 
      [db_name] = d.name
    , [table_name] = SCHEMA_NAME(o.[schema_id]) + '.' + o.name
    , s.last_user_update
FROM sys.dm_db_index_usage_stats s
JOIN sys.databases d ON s.database_id = d.database_id
JOIN sys.objects o ON s.[object_id] = o.[object_id]
WHERE o.[type] = 'U'
    AND s.last_user_update IS NOT NULL
    AND s.last_user_update BETWEEN DATEADD(day, -1, GETDATE()) AND GETDATE()
    and s.[object_id] in (select OBJECT_ID(ClassTableName)
    from CMS_Class where ClassIsForm =1 )

You might have a few hundred forms... to go and query few hundred tables might be unproductive. I usually get 18-20 out 100+ we have.

Upvotes: 1

Related Questions