Hi all,
For a client we are working on an importer script to migrate the content from the clients website.
I have a model, lets call it Article. Article has a slug
, body
and title
which are optionally translatable.
Via the web interface I can create an Article only in en
or only in nl
(one of the locales I’m using).
However when I’m trying to create a record via the Node.js client (datocms-client
) I’m getting 422 INVALID_FIELD
:
"ApiException: 422 INVALID_FIELD (details: {"field":"slug.en","field_label":"Slug","field_type":"slug","code":"VALIDATION_REQUIRED","options":{}}) at /importer/node_modules/datocms-client/lib/Client.js:135:33 ...)"
When I inspect the error it tells me "VALIDATION_REQUIRED"
.
{
"code": "VALIDATION_REQUIRED",
"field": "slug.en",
"field_label": "Slug",
"field_type": "slug"
}
Same error for the other translated fields.
From this file I learned that this means that the field is required. Which confuses me because I am providing values for all fields.
So I expect that the problem is related to me passing null
for the unavailable locale like so:
slug: {
nl: slug,
en: null,
},
title: {
nl: title,
en: null,
},
// ...
When I’m not providing the other locale
as null
I’m getting MISSING_LOCALES
errors.
This issue is blocking the import of the data and we cannot deliver to our client without the data imported.
I’m very eager to hear what the correct course of action would be in this scenario.
Furthermore I’m having a really hard time using the Node.js client due to incomplete documentation.
What I’m missing are:
- an overview of all possible error codes and what they mean, right now I need to use the translations
- documentation on required utils such as
buildModularBlock
which is only referenced in this product update - documentation on creating different types of modular content
- Consistency in documentation
-
Using Node.js client saids use response from
uploadFile
-
Create record saids to use an
uploadId
-
Using Node.js client saids use response from