We have a content-type that includes a field of type Image. There is also an image file that has been uploaded to Drupal.
We are trying to add new content via a Drupal 8 REST POST. A new node is successfully created when the POST finishes, but the image field is never set. Here is what we are trying:
POST to: http:///entity/node?_format=hal_json
The normal 4 headers are set
POST Body:
{
"_links": {
"type": {
"href": "http://localhost:8087/rest/type/node/product"
}
},
"title": [{"value":"ProductC"}],
"field_description": [{"value":"ProductC Description"}],
"field_product_image": [{"src":"/sites/default/files/2017-03/samplelogo_1.jpeg"}],
"field_product_name": [{"value":"ProductCName"}],
"field_product_n": [{"value":"prodC"}]
}
Any pointers on how to construct the "field_product_image" line in the payload to link the image to new content node?
Thanks
target_id
instead ofsrc
and using the File ID as the value instead?