Adding data to page type data table through API

Srikrishna Podduturi asked on July 1, 2019 13:33

Hi Team,

I have created a page type for products in our website. This created a table in the database. The data to this table should be inserted through an another application. Could you please advise how could i add data to the page type through Kentico API. Also please let me know if i could add data by writing a stored procedure.

Thanks, Krishna.

Correct Answer

Brenden Kehren answered on July 2, 2019 14:52

If you're creating a custom scheduled task, there's no reason to complicate taking the XML then pass it to a REST API, when you can simply use the Kentico API methods. Here's the API Examples on how to create pages using the Kentico API.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Dmitry Bastron answered on July 1, 2019 13:51

Hi Srikrishna!

There are a few options available:

I would not recommend writing stored procedures and amending Kentico objects directly in the database as your page type actually contains only custom fields, but all other CMS-related fields are stored in other tables (please read more here).

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on July 1, 2019 14:06

Another option or two you have in addition to what Dmitry mentioned are:

  • creating a soap web service or an endpoint in your Kentico website to be published to access those methods externally.
  • Create a class or application within your other application, importing the Kentico libraries and referencing the connection string to pass the data over.
0 votesVote for this answer Mark as a Correct answer

Srikrishna Podduturi answered on July 2, 2019 08:25

Thank you Dmitry & Brenden. Our team has decided to save the data in XML files which will be updated on a regular basis and stored in a ftp location. I have to get the data from XML files and update the data in the page types of Kentico db.

COuld you please advise best way to achieve this.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on July 2, 2019 13:51

You can create a PowerShell script and import using CLI and KIM. Or you can create a scheduled task to process the import. I'd prefer the scheduled task as you can add more error handling.

0 votesVote for this answer Mark as a Correct answer

Srikrishna Podduturi answered on July 2, 2019 14:34

Thanks. So, I will create a scheduled task and then pass the XML data to the Rest API to insert records into corresponding page types table in the database.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.