How to add a new field with some computed value in REST response of Kentico for all the document typ

Binod Paikaray asked on October 26, 2017 17:26

Hello,

Is there any way to add a new filed with some computed value in REST response of Kentico for all the document types at once?

Thanks,

Binod Paikaray

Recent Answers


Brenden Kehren answered on October 26, 2017 17:50

The built-in Kentico REST service is a simple REST service meaning it cannot perform the actions you're looking for. So my suggestion is to create your own service to do what you need.

1 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on October 26, 2017 17:57 (last edited on October 26, 2017 18:10)

Computed column in terms of SQL? Not possible.You talking here about changing database schema via REST. REST service is not meant for that. You manage data (i.e. CRUD operations) via REST but not changing DB.

1 votesVote for this answer Mark as a Correct answer

Roman Hutnyk answered on October 27, 2017 10:13

You could try to achieve this by implementing HTTPModule, however I'm not 100% sure if this would work well with Kentico, with custom .NET app it should work.

Here is another approach described to achieve similar behavior, but it is not applicable to all objects at once, but to particular one.

1 votesVote for this answer Mark as a Correct answer

Binod Paikaray answered on October 27, 2017 12:47 (last edited on October 27, 2017 12:49)

Thanks to all for your responses!

Actually, my problem is with the linked nodes DocumentNamePath in the REST response. I have a linked node which has some child nodes among which few are linked and few are not. For the linked child node, it's showing it's original node's DocumentNamePath which is fine but for the un-linked child nodes also it's showing that linked node DocumentNamePath as it's parent is a linked node.

We want to get the current hierarchy's path as the DocumentNamePath.

Below, I'm trying to explain it with an example.

A --> B (Linked node may be some X --> Y)
      |--> C (Linked Node say M --> N)
      |--> D (Not linked to any node)

where A is the parent of B and B is the parent of C and D.

Now, the DocumentNamePath for:

B is X --> Y --> B

C is M --> N --> C

D is X --> Y --> B --> D

But for D, we want it as

A --> B --> D in the REST response itself as some other application is consuming the data from there.

I hope, my requirement is clear now.

Please help me to accomplish this task.

Thanks,

Binod Paikaray

0 votesVote for this answer Mark as a Correct answer

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