422 INVALID_FIELD on setting editor in Links field

Hi,

I’m trying to create a Links field and set the editor to link_embed instead of the default link_select. However, I’m getting a 422 INVALID_FIELD trying to do this. Doing it through the GUI does work so I must be doing something wrong here. Can you help out?

Request and response below.

Cheers,

Floris

Request

POST https://site-api.datocms.com/item-types/390858/fields

content-type: application/json
accept: application/json
authorization: Bearer [REDACTED]
user-agent: js-client v3.2.0
X-Api-Version: 3
X-Environment: floris-tenhove--local--feature-ch8704

{"data":{"type":"field","attributes":{"label":"Cases","field_type":"links","api_key":"featured_cases","localized":false,"validators":{"items_item_type":{"item_types":["390871"]}},"appearance":{"editor":"link_embed","addons":[],"parameters":{}},"hint":null},"relationships":{"fieldset":{"data":{"type":"fieldset","id":"5795"}}}}}

Response

422 Unprocessable Entity


{"data":[{"id":"f7f81e","type":"api_error","attributes":{"code":"INVALID_FIELD","details":{"field":"appearance.editor","code":"VALIDATION_INVALID","message":"incompatible with field type"}}}]}

Exception details:

  ApiException: 422 INVALID_FIELD (details: {"field":"appearance.editor","code":"VALIDATION_INVALID","message":"incompatible with field type"})

hey @floris.tenhove can you please try to use links_embed as the editor, instead of link_embed?

1 Like

That works, thanks! It seems this should be updated in the documentation as I couldn’t find it there. Does this also mean it should be singular link_embed for a single link field and plural links_embed for multi link fields?

Just found this issue too, the documentation here: Create a new field - Field - Content Management API refers to the singular editors for the multiple links field.

1 Like

hi @jamie.reddell thanks! I’ve fixed the docs (will be deployed shortly)

1 Like