Getting a 422 Unprocessable Entity while trying to create a media entity via rest api. I've failed to find any docs regarding what params/entity type I need. This is how I usually create entities via core rest.

const data = {
  _links: {
    type: {
      href: serverUrl + '/rest/type/entity/media/image',
  field_media_image: [
      target_id: response.data.fid[0].value, // uploaded file ID

return postNode('/entity/media', data, props.token);

I've tried rest/type/entity/media as well. Both media and media/image return the same error.

Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException: Type {domain}/rest/type/entity/media/image does not correspond to an entity on this site. in Drupal\rest\RequestHandler->deserialize() (line 184 of /var/www/{domain}/core/modules/rest/src/RequestHandler.php).

enter image description here

What am I missing?

  • Are you sure postNode() is using a POST request?
    – apaderno
    Jun 16 at 8:47
  • @apaderno yes. I use the same function throughout my webapp. Jun 16 at 10:08


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.