Unlock seamless workflows and faster delivery with our latest releases – get the details

How Do I Publish Content via the HTTP-API?

7 replies
Last updated: Nov 30, 2021
I have custom project with HTTP-api, that i am
writing
to Sanity Content Lake. My question how do i "publish" the content via HTTP-api?
Nov 29, 2021, 8:39 PM
What does your current script for writing to your Content Lake look like?
Nov 29, 2021, 9:42 PM
A simple post
request


        body: JSON.stringify({
          mutations: [
            {
              create: {
                _type: 'programs',
                title: title,
                description: description,
              },
            },
          ],
        })
 
If that what you mean with Script?
Nov 29, 2021, 9:47 PM
Yep! It looks like you're missing an
_id
field. You can use a package like
uuid
to generate a random id here. As long as you don't prefix the id with
drafts.
it'll show up as a published document in your dataset.
Nov 29, 2021, 9:59 PM
what is
drafts
?
Nov 29, 2021, 10:03 PM
Yep! It looks like you're missing an
_id
field. You can use a package like
uuid
to generate a random id here. As long as you don't prefix the id with
drafts.
it'll show up as a published document in your dataset.
Nov 29, 2021, 9:59 PM
Any
_id
that is prefixed with
drafts.
in your Studio will be a draft, not a published document. More on that here .
Nov 29, 2021, 10:07 PM
I see, thank you!
Nov 30, 2021, 1:07 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?