Closed toadle closed 8 years ago
I investigated this further. The Validation-problem that occurs is this one:
"{
"sys": {
"type": "Error",
"id": "InvalidEntry"
},
"message": "Validation error",
"details": {
"errors": [
{
"name": "type",
"value": null,
"type": "Object",
"details": "The type of \\"value\\" is incorrect, expected type: Object",
"path": [
"fields",
"abilities",
"en-US",
0
]
},
{
"name": "type",
"value": null,
"type": "Object",
"details": "The type of \\"value\\" is incorrect, expected type: Object",
"path": [
"fields",
"abilities",
"en-US",
1
]
},
{
"name": "type",
"value": null,
"type": "Object",
"details": "The type of \\"value\\" is incorrect, expected type: Object",
"path": [
"fields",
"abilities",
"en-US",
2
]
},
{
"name": "type",
"value": null,
"type": "Object",
"details": "The type of \\"value\\" is incorrect, expected type: Object",
"path": [
"fields",
"abilities",
"en-US",
3
]
}
]
},
"requestId": "..."
}
Seems like the API does not accept the creation of Links via the API in the format that is currently send. How is it supposed to be send? There isn't any documentation online.
Hey @toadle,
Looks like I totally overlooked this case, I forgot linked entries somehow 😅
I might be able to have a simple fix early next week.
Would that be ok for you?
Cheers
@dlitvakb Thanks for getting back! A quick fix would be really great.
Also I have to revise my previous statement. I tried to replicate this with just using contentful.rb
and content-management.rb
.
Some time ago doing this:
space = Contentful::Management::Space.find(...)
content_type = space.content_types.find(...)
content_type.entries.create(@fields[default_locale])
in a Contentful::Entry
worked. I added other Contentful::Entry
s as properties there.
Sadly now it does not anymore.
Did the API change?
No, it did not. #selfanswer :-)
@dlitvakb But should be fixed by this: https://github.com/contentful/contentful-management.rb/pull/105
Only other solution I see is to first convert everything from Contentful::Entry
to Contentful::Management::Entry
before saving. Root cause was that contentful-management.rb
would convert an [<Contentful::Entry>, <Contentful::Entry>, <Contentful::Entry>]
to [nil,nil,nil]
which is not OK with the API.
Hey @toadle,
Sounds good! Just made a few comments on that PR.
Cheers
Hey guys,
we are trying to populate an initial content-set via
contentful_model
. Now we have classes like this:Now creating a person like so
ContentfulPerson.create(name: 'some_name')
is working. But what is now working is something like this:Gives me
But I also tried
Is this supposed to work already?
Sidenote: I did this successfully with just using classes and objects from
contentful.rb
andcontentful-management.rb
. In combination they support setting references like this.Thanks for any help!