What additional work would be required to enable this module to updated existing entities with image attachments?

CommentFileSizeAuthor
#5 1273334-wrapper-structure-5.patch787 bytesamitaibu
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dasjo’s picture

Title: What additional work would be required to... » Updating existing entities with image attachments
Category: feature » support
Status: Active » Postponed (maintainer needs more info)

from the question it is not quite clear what exactly you want to accomplish, please elaborate more precisely :)

Dinesh Kumar Sarangapani’s picture

How Image fields and other media fields are exposed in service.Whether it should expose image URI?
I get only alt tag as shown below

"field_image": {

    * "alt": "Abluo diam euismod iustum lenis natu quae qui tamen turpis."

},
dgtlmoon’s picture

Status: Postponed (maintainer needs more info) » Active

I can confirm the same problem, essentially the poster is saying their content field (file/image) is not showing any data

example where field_picture has data when loaded through the HTTP GET browser stylee, but not 1.json RESTws stylee

{"nid":"2","vid":"2","is_new":false,"type":"picture","title":"funny","language":"und","url":"http:\/\/d7services.localhost\/node\/2","edit_url":"http:\/\/d7services.localhost\/node\/2\/edit","status":"1","promote":"0","sticky":"0","created":"1325697881","changed":"1325697881","comment":"2","comment_count":"0","comment_count_new":false,"body":[],"field_picture":[]}

amitaibu’s picture

Title: Updating existing entities with image attachments » Image and file fields are omitted from the response
Category: support » bug

1) Create a node with a file/ image
2) Query node (e.g. node/1.json) -- the file info with the file ID isn't there.

amitaibu’s picture

Status: Active » Needs review
FileSize
787 bytes

Patch fixes the problem by changing the IF statement, as EntityStructureWrapper's value can be retrieved by $property->value() as EntityValueWrapper does.

klausi’s picture

Hm, this workaround does not look right to me. Why does the EntityStructureWrapper not contain any property information? Just using the value of the structure wrapper would work for array structures, but if this is some other kind of structure (object?) then we would run into a problem.

amitaibu’s picture

Sorry klausi, I didn't understand your comment.

Are you able to get file info without the patch?

klausi’s picture

Status: Needs review » Closed (duplicate)

Digging into this I found that the access handling of files is broken, that's why the file field is omitted. This is a known issue of entity API: #1136356: Fix file access (and this has been an issue in RESTWS some time ago, I just forgot about it, sorry).

klausi’s picture

Status: Closed (duplicate) » Active
Issue tags: +GSoC 2012

Reopening to track this as Sebastian will work on it during GSoC.

sepgil’s picture

Status: Active » Fixed

The Entity API Issue #1136356: Fix file access was fixed and therefore image and other file fields should now be included in responses.

Automatically closed -- issue fixed for 2 weeks with no activity.