nuxt-directus icon indicating copy to clipboard operation
nuxt-directus copied to clipboard

POST /versions

Open mfito opened this issue 1 year ago • 1 comments

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, })

mfito avatar May 23 '24 13:05 mfito

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

sandros94 avatar May 23 '24 13:05 sandros94

--> https://github.com/Intevel/nuxt-directus/discussions/271

nuxt-directus-next is EOL

casualmatt avatar Aug 20 '24 15:08 casualmatt