fallcool
fallcool

Reputation: 53

How to upload image with Rest in Drupal 8.3?

I want to upload image to Drupal server via Rest. I found a post https://drupal.stackexchange.com/questions/118106/how-to-send-files-to-drupal-8-via-rest and follow the instructions in the answer. But a error message was recieved: "message": "A fatal error occurred: Field _links is unknown.". Anyone know how to get it done in Drupal 8.3? Thanks!

Upvotes: 0

Views: 1529

Answers (1)

J SJSO
J SJSO

Reputation: 11

follow instructions here: https://www.drupal.org/node/2682341#comment-11965256 additionally add the X-CSRF-Token to the header as well. I tested this on 8.3.2

one thing I noticed is that images are in "Temporary" status, I'm not yet too familiar with the API but one workaround for this is to change the file status in the file_managed table in the database...

Upvotes: 1

Related Questions