Developer forum

Forum » Development » Webapi: Getpage by itemType AND culture

Webapi: Getpage by itemType AND culture

Kasper Legarth
Reply

Is it possible to get all pages from a DW solution by itemType and a Culture?

We are building a software that needs to get release notes from a dw Solution. I know I can get pages by itemtype with: /dwapi/content/pages?ItemType=ReleaseNote

In this scenario I get 3 pages that are the same pages but in different languages.  I know I can use the areaId param, but the other software does not know that id but the culture it is current in. I would like to avoid hardcode some id's in the code. 

Is it possible to combine the two?

Kind regards
Kasper


Replies

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Kasper,

 

The webapi is contextless, so you cannot do that.

 

What you can do in that software is to call /dwapi/content/areas first to get the proper areaId for the culture you need before calling /dwapi/content/pages?ItemType=ReleaseNote. That would not be hardcoded, although you might need to add some other validations in case other areas with the same cultures are created in Dynamicweb.

 

 

Best Regards,

Nuno Aguiar

 
Kasper Legarth
Reply

Hi Nuno.

Thank you for your answer. That would be a solution for none hardcoded info. I'm guessing I was hoping for a solution that only need one request. Oh well, you can't get it tall.

Have a nice day.

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

HI Kasper,

 

You are welcome. You can also build your own custom endpoint (in DW) that takes the culture as a parameter and then internally gets the areaId and calls the /dwapi/content/pages endpoint and returns the entire response.

 

But that's just shifting the solution. It has it's pros and cons.

 

Best Regards,

Nuno Aguiar

 

You must be logged in to post in the forum