Discussion about import schema and formatting issues, with suggestions for resolving the problem.

12 replies
Last updated: Sep 3, 2021
Hey all, I'm trying to figure out an import schema. A simple example;
{
    "title": "test-2",
    "status": "publish",
    "_type": "post",
    "slug": {
      "_type": "slug",
      "slug": "/blog/test-2/"
    },
    "body": {
      "_type": "blockContent",
      "body": "\n<p>stuff</p>"
}
Sep 3, 2021, 4:43 PM
...as an aside, how I am formatting my import "breaks" desk and the quick and dirty way I found to fix it is to delete my dataset on the dashboard. This works for me because I'm just testing. But this would be death if I had a full dataset. For more detail when I try to click into the corrupted post desk crashes and the gui delete is in the post... I'm sure I could delete is API wise but this is more work.... thinking about it I'm sure I could delete from Postman or Insomnia but again just more work... Just trying to help. Cheers
Sep 3, 2021, 5:08 PM
Hey Lucas! A few things stand out to me initially!
First, regarding your slug. It has two keys
_type
and
current
. That could be tripping you up here.
Then, for the block content you're trying to import, there's this
thread from earlier in the week that would be helpful. It's about converting existing
text
to Portable text, but could be adapted for your needs.
Sep 3, 2021, 5:57 PM
Hey Lucas! A few things stand out to me initially!
First, regarding your slug. It has two keys
_type
and
current
. That could be tripping you up here.
Then, for the block content you're trying to import, there's this
thread from earlier in the week that would be helpful. It's about converting existing
text
to Portable text, but could be adapted for your need.
Sep 3, 2021, 5:57 PM
How are you importing data? Is it via the CLI or a client library?
Sep 3, 2021, 5:57 PM
cli
Sep 3, 2021, 6:12 PM
cli
Sep 3, 2021, 6:12 PM
Thank you for the response is
current
the key for any given content type of just slug?
Sep 3, 2021, 6:22 PM
Is there a better placing in the docs I should be looking
Sep 3, 2021, 6:22 PM
Is there a better placing in the docs I should be looking
Sep 3, 2021, 6:22 PM
Got it! It's just the slug field that stores its value in the
current
property. If you're looking for the properties that are required for all schema types, there's a complete list of each type here that links out to their individual pages. That should help you reshape the data you're importing into a format the Studio can display.
Sep 3, 2021, 6:39 PM
Got it! It's just the slug field that stores its value in the
current
property. If you're looking for the properties that are required for all schema types, there's a complete list of each type here that links out to their individual pages. That should help you reshape the data you're importing into a format the Studio can display.
Sep 3, 2021, 6:39 PM
Oh, and I'm not sure if you know about this Wordpress to Sanity repo . It can probably help much more than I can!
Sep 3, 2021, 7:44 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?