Active
Project:
RESTful Web Services
Version:
7.x-2.2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
31 May 2012 at 05:24 UTC
Updated:
27 Nov 2014 at 19:51 UTC
Jump to comment: Most recent
Hello,
I'm using filed Collection module to arrange fields in my site..
field Collection has working entity property integration...
but i can't get the Json file
if i go to http://localhost/testingservices/field-collection/field-orders/1.json i will get the first value of the field collection in an html view and not in JSON format
Appreciate your help
Comments
Comment #1
Wassim Ghannoum commentedi Think it is working now:
using this format, http://localhost/testingservices/field_collection_item/3.json
but how can i create a new item of field_collection using this module ? ?
Comment #2
sepgil commentedYou have to use the HTTP Put Method and I think also set the Content-Type header to an appropriate format(like application/json) to create a new entity.
Comment #3
Wassim Ghannoum commentedI'm using java script
and i used this code:
in the log file of the module i'm getting:
2012-05-31T09:08:49+0300
Resource: field_collection_item
Operation: create
Format: application/json
Id:
Payload: {"field_food_reference":{"id":1,"resource":"node"},"field_line_options":["Bala Toum","Bala Banadoura","Markouk"],"field_name":"field_orders","field_order_line_price":"3","field_quantity":"1","host_entity":{"id":4,"resource":"node"},"item_id":4}
But nothing has been created!
i tried to add an item manually from the website and this was the result:
{"field_food_reference":{"uri":"http:\u002F\u002Flocalhost\u002Fdrupanium\u002Fnode\u002F1", "id":"1", "resource":"node"}, "field_quantity":"10", "field_order_line_price":"30", "field_line_options":[ ], "item_id":"3", "field_name":"field_orders", "url":"http:\u002F\u002Flocalhost\u002Fdrupanium\u002Ffield-collection\u002Ffield-orders\u002F3", "host_entity":{"uri":"http:\u002F\u002Flocalhost\u002Fdrupanium\u002Fnode\u002F3", "id":"3", "resource":"node"}}
Comment #4
Wassim Ghannoum commentedI'm using java script
and i used this code:
in the log file of the module i'm getting:
2012-05-31T09:08:49+0300
Resource: field_collection_item
Operation: create
Format: application/json
Id:
Payload: {"field_food_reference":{"id":1,"resource":"node"},"field_line_options":["Bala Toum","Bala Banadoura","Markouk"],"field_name":"field_orders","field_order_line_price":"3","field_quantity":"1","host_entity":{"id":4,"resource":"node"},"item_id":4}
But nothing has been created!
i tried to add an item manually from the website and this was the result:
{"field_food_reference":{"uri":"http:\u002F\u002Flocalhost\u002Fdrupanium\u002Fnode\u002F1", "id":"1", "resource":"node"}, "field_quantity":"10", "field_order_line_price":"30", "field_line_options":[ ], "item_id":"3", "field_name":"field_orders", "url":"http:\u002F\u002Flocalhost\u002Fdrupanium\u002Ffield-collection\u002Ffield-orders\u002F3", "host_entity":{"uri":"http:\u002F\u002Flocalhost\u002Fdrupanium\u002Fnode\u002F3", "id":"3", "resource":"node"}}
Comment #5
ntigh52 commentedHi All,
You are right!!
When I have entity reference field so on the jsom I can get just the entity-id ( not the title as it display on the node).
But, in the field collection module, the field_collection_item id is only shown.
Is there not a way to send all the information of the fields collection with the json?
Important to mention that on the $node variable inside the field collection field I have all the information.
Thanks a lot.
Comment #6
ntigh52 commentedComment #7
roppa_uk commentedI'm having the same problem. I've created a custom module that we use in a field collection. The data is there, but it is not being exposed using RESTws. I tested if the data was there in a hook, and the fields are there. It is like fields are being filtered by the time RESTws is finished processing. Any ideas?