Skip to content

REST API - Error This relationship field has the following invalid relationships: 51 0 #7

@MiNeves00

Description

@MiNeves00

Using the REST API since i am using Python to create a Post it keeps giving me the error:

Response: {"errors":[{"name":"b","data":{"collection":"posts","errors":[{"label":"Meta > Related Posts","message":"This field has the following invalid selections: 71, ","path":"relatedPosts"}]},"message":"The following field is invalid: Meta > Related Posts"}]}

I have tried sending it in multiple ways, like literally reading another Posts's relatedPosts and sending them here so as to be sure of the format and the error persists. I saw that similar errors #2 already existed in the payloadcms package and have recently suposedly been fixed, but on the REST API it seems to persist. The id field keeps giving problems...

[{'id': 71,
  'trendingScore': 6,
  'title': 'Long Immigration Lines ',
  'categories': [{'id': 7,
    'title': 'Immigration',
    'slug': 'immigration',
    'slugLock': True,
    'parent': None,
    'breadcrumbs': [{'id': '685c67e7136dc700015e4225',
      'doc': 7,
      'url': '/immigration',
      'label': 'Immigration'}],
    'updatedAt': '2025-06-25T21:19:35.301Z',
    'createdAt': '2025-06-25T21:19:35.277Z'},
   {'id': 13,
    'title': 'Transportation',
    'slug': 'transportation',
    'slugLock': True,
    'parent': None,
    'breadcrumbs': [{'id': '685f0627e32a20000182421b',
      'doc': 13,
      'url': '/transportation',
      'label': 'Transportation'}],
    'updatedAt': '2025-06-27T20:59:19.603Z',
    'createdAt': '2025-06-27T20:59:19.578Z'}],
  'publishedAt': '2025-07-02T13:22:15.887Z',
  'slug': 'long-immigration-lines-test-portugals-new-high-tech-border-checks',
  'meta': {'title': 'Long Immigration Lines Test Portugal’s New Border Checks',
   'image': {'id': 32,
    'alt': 'Airport Lines',
    'caption': None,
    'updatedAt': '2025-07-03T08:33:11.204Z',
    'createdAt': '2025-07-02T12:55:03.135Z',
    'url': '/api/media/file/hero_9-1.jpg',
    'thumbnailURL': '/api/media/file/hero_9-1-300x300.jpg',
    'filename': 'hero_9-1.jpg',
    'mimeType': 'image/jpeg',
    'filesize': 101474,
    'width': 745,
    'height': 745,
    'focalX': 50,
    'focalY': 50,
    'sizes': {'thumbnail': {'url': '/api/media/file/hero_9-1-300x300.jpg',
      'width': 300,
      'height': 300,
      'mimeType': 'image/jpeg',
      'filesize': 21851,
      'filename': 'hero_9-1-300x300.jpg'},
     'square': {'url': '/api/media/file/hero_9-1-500x500.jpg',
      'width': 500,
      'height': 500,
      'mimeType': 'image/jpeg',
      'filesize': 52726,
      'filename': 'hero_9-1-500x500.jpg'},
     'small': {'url': '/api/media/file/hero_9-1-600x600.jpg',
      'width': 600,
      'height': 600,
      'mimeType': 'image/jpeg',
      'filesize': 70965,
      'filename': 'hero_9-1-600x600.jpg'},
     'medium': {'url': None,
      'width': None,
      'height': None,
      'mimeType': None,
      'filesize': None,
      'filename': None},
     'large': {'url': None,
      'width': None,
      'height': None,
      'mimeType': None,
      'filesize': None,
      'filename': None},
     'xlarge': {'url': None,
      'width': None,
      'height': None,
      'mimeType': None,
      'filesize': None,
      'filename': None},
     'og': {'url': '/api/media/file/hero_9-1-1200x630.jpg',
      'width': 1200,
      'height': 630,
      'mimeType': 'image/jpeg',
      'filesize': 125472,
      'filename': 'hero_9-1-1200x630.jpg'}}},
   'description': 'Expect long queues at airport border control as new VIS4 security system rolls out. Read more.'}}]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions