nuxt-directus
nuxt-directus copied to clipboard
POST /versions
Is your feature request related to a problem? Please describe.
I want to POST a version of an existing collection item via API
Describe the solution you'd like
in directus SDK there is a function "createContentVersion" width params to create a version. It returns itself
createContentVersion({ key: 'my_version', name: 'My Version', collection: 'my_collection', item: 1, })
Currently the module doesn't support it out of the box.
But if you are using nuxt-directus-next you could use the built-in Rest client and any sdk function, like so:
import { createContentVersion } from '@directus/sdk'
const client = useDirectusRest()
async function newContentVersion(item) {
await client.request(createContentVersion({
key: 'my_version',
name: 'My Version',
collection: 'my_collection',
item
}))
}
ps: I still haven't used versions, so refer to the official Directus Docs
--> https://github.com/Intevel/nuxt-directus/discussions/271
nuxt-directus-next is EOL