0

I am searching for a solution for past few days but can't find it :(

I have exposed a node with rest api views and there's a couple of field collections inside my node which i want to access over API but the api is retuning field collection IDs not the actual data. How can i get the values of field collection without sending aother request to api for values?

"field_custom_data": {

"und": [

 {
   "value": "3",
   "revision_id": "3"
 },
 {
   "value": "4",
   "revision_id": "4"
 },
 {
   "value": "5",
   "revision_id": "5"
 },
 {
   "value": "6",
   "revision_id": "6"
 },
 {
   "value": "7",
   "revision_id": "7"
 },
 {
   "value": "8",
   "revision_id": "8"
 }
] },
0

Before returning response to api you should load field collection using field collection ID, then you can get fields value of field collection.

entity_load('field_collection_item', array($item_id))

Source: How to load field collection

  • Thanks @Yogesh Kushwaha, but how do i intercept the API response to add add those values? thanks. – Romin Apr 29 '18 at 1:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.