Hello,

Thanks for the module.

With the patch from #2892341-2: File entity normalizer service priority it works for POST operation.

But I am trying to PATCH an existing file entity to erase/create a physical file.

I am trying to make a request on http://mydomain/jsonapi/file/image/129b7487-97a3-40d6-9f26-9c36c0ff1fa8 with the following (truncated payload):

{
  "data": {
    "type": "file--image",
    "id": "129b7487-97a3-40d6-9f26-9c36c0ff1fa8",
    "attributes": {
      "data": "/9j/......",
      "uri": "public://image.jpg"
    }
  }
}

The physical file is created, but I got the following error:

{
    "errors": [
        {
            "title": "Bad Request",
            "status": 400,
            "detail": "The provided field (data) does not exist in the entity with ID 129b7487-97a3-40d6-9f26-9c36c0ff1fa8.",
            "links": {
                "info": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1"
            },
            "code": 0,

Thanks for any help.

Comments

Grimreaper created an issue. See original summary.

j1mb0b’s picture

+1

gerzenstl’s picture

I thought by adding at the beggining of the denormailzer:

$data_file = $data['data'];
    unset($data['data']);

would be enough to deal with the exception throwed by updateEntityField() of the EntityResource controller, but it didn't work.

I'm missing something here?

spleshka’s picture

Status: Active » Closed (duplicate)