Closed (works as designed)
Project:
Services
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 Nov 2016 at 13:32 UTC
Updated:
22 Nov 2016 at 21:06 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
sysosmaster commentedComment #3
sysosmaster commentedComment #4
sysosmaster commentedComment #5
tyler.frankenstein commentedComment creation with fields does work, I've used it with many projects. Please share the code/structure you're using when trying to create a comment, as well as what core/contrib fields you are trying to use.
Thank you for the patch, and if we were ever to make a 7.x-4.x branch of Services, your approach would be used. It's unlikely we'll be able to accept that patch though for 7.x-3.x, because we've been using the "forms" approach for many years now.
Comment #6
sysosmaster commentedit was not working for files (e.a. you upload a json for a comment service with as the JSON
{"Comment":{"nid":"1","cid":0,"pid":0,"uid":7,"language":"und","status":1,"subject":"Processing Result IfcOpenHouse.ifc","is_anonymous":0,"comment_body":{"und":[{"value":"{\"IfcApplication\": \"IfcOpenShell 0.5.0-dev\", \"IfcDoor\": {\"Total amount of IfcDoor elements\": 1}, \"IfcProjectGUID\": \"1234567890\", \"IfcWallStandardCase\": {\"Total amount of IfcWallStandardCase elements\": 4}, \"IfcWindow\": {\"Total amount of IfcWindow elements\": 5}}"}]},"field_result_file":{"und":[{"fid":"66","display":1}]}}}I do this after I upload the file using the file endpoint.
I made the patch so other can use it allthough i totally agree to wait for the 7.x-4.x release for this approach (if we ever get one).
Comment #7
tyler.frankenstein commentedYour JSON data looks fine, except for the "comment_body" value looks pretty strange.
P.S. Maybe try removing the "display" property from your file JSON object too.
Comment #8
sysosmaster commentedAll of it works except for the field_result_file, that gets lost completely by the form handler somewhere (could not pinpoint it completely with my debugger). I suspect it is a similar problem as attaching files to node's. the form simply silently drops the file attaching.
Comment #9
tyler.frankenstein commentedInteresting. In a case like this, I'm starting to think that a contrib/custom module on your site may be "form altering" that particular field during Services calls. Do you see any potential suspects in your module list?
Otherwise I'm very certain that attaching file ids to nodes and comments is working properly, I use both currently in a few different apps. This patch may be useful to: #2224803: Possible patch for multi-value fields
Comment #10
kylebrowning commentedYeah we use form submit to get all the benefits of the hook system, this is a wont fix.