Hi, I’m using the write api to migrate an entire blog from datoCMS to Builder.
Currently, I have already migrated the authors and categories (there are separated models).
When migrating the entire blog post, how could I write the ‘authors’ field (it’s a list of references to the author model) and the category (it’s a reference to the category model)?
I would have to filter to catch the respective category and authors, but then how can I write them in the API? I know how to write strings… but a reference type?
So yes, as you said you would probably need to make a call to the content API to pull the authors, and then filter to find the correct author name and pass their content ID and model name into the write API call for creating the blog posts. Does that answer your question? I would recommend trying it out with one or two posts to get it working correctly and then rolling it out across your entire content log.
Let me know how it goes or if you have any further questions!
Hi @emiliano when you say it doesn’t work for you what does that mean? Is it writing the content to builder but without the correct reference? Is it giving an error?
Do you have any examples in your space? What is the API key of the space you are working in , I didnt see any spaces with the relevant data when I tried to search for your store.
Hope you don’t mind, we can delete once testing is done. What value are you passing as the ID? It should be the content id, so for the General category, the ID should be 1352e4da86234d4b9086eb77a1bfbedb, the same as the ID in the builder content URL
I also opened another question here about the same but with lists type… I couldn’t write them with the API, is there any similar secret for those? thanks