angular-contentful icon indicating copy to clipboard operation
angular-contentful copied to clipboard

modifying api responses

Open p3sn opened this issue 8 years ago • 3 comments

Hi,

I'm quite new to contentful and the angular-contentful-module but it looks very good and I love your project. It helped me a lot. I just got notified about new options to modify the api responses in this article: https://www.contentful.com/r/knowledgebase/modifying-api-responses/

It looks like that option would help me a lot to downsize the response.data to only the fields I need. Is this modyifing also posisble in the angular-contentful-module?

Regards, Peter

p3sn avatar Oct 19 '16 13:10 p3sn

@p3sn — Great question! Have you already tried this?

<pre contentful-entry="'sys.id=6KntaYXaHSyIw8M6eo26OK&select=fields.productName,fields.price'">
  {{ $contentfulEntry | json }}
</pre>

Can you let us know how it goes? Thanks!

jvandemo avatar Oct 28 '16 09:10 jvandemo

Hi jvandemo, thanks for your reply and sorry for my late reply. This works great, I can narrow the request down to only the fields I need.

I have another related question to optimize requests... Let's say I have created multiple 'pages' in contentful and total amount of data is getting large. Would you still load all entries in the app.controller and then select only the data you need per page? Or would you load only the data you need in the controller ?

Thanks, Regards, Peter

p3sn avatar Feb 03 '17 08:02 p3sn

@p3sn — Awesome, great to hear it worked. Can you give more details about your new question? Do you mean your "pages" are content entries in Contentful? And do you filter some pages? Or fields from the pages? Thanks!

jvandemo avatar Feb 04 '17 11:02 jvandemo