Iām banging my head against a wall with this seemingly simple task. Iām following the docs here: Create a new record - Record - Content Management API but getting an error.
Hereās my code:
import {buildClient} from '@datocms/cma-client-browser'
const client = buildClient({apiToken: 'mykey'})
My key is associated with a role which has permissions to create my āsubmissionā content type.
const record = await client.items.create({
item_type: {type: 'submission', id: '1668821'},
name: 'lorem',
})
I then get the error:
[
{
"id": "96ae3c",
"type": "api_error",
"attributes": {
"code": "INVALID_FORMAT",
"details": {
"messages": [
"#/data/relationships/item_type/data/type: failed schema #/definitions/item_type/definitions/data/properties/type: submission does not match /^item_type$/."
]
}
}
}
]
Am I doing something stupid, or are the docs just wrong? Thereās so little complexity here, I canāt see anywhere I could have gone wrong.