Delete with create mutation to the metadata endpoint

Hello,

Hope you are having a good day. I am trying to batch delete metadata with the useDataMutation hook, however I am not sure what the correct configuration is to send the url parameter importStrategy=DELETE.

I have tried:

const deletePisMutation = {
resource: metadata,
type: ‘create’,
data: ({ data }) => data,
variables: {
importStrategy: ‘DELETE’,
},
}

const deletePisMutation = {
resource: metadata,
type: ‘create’,
data: ({ data }) => data,
options: {
importStrategy: ‘DELETE’,
},
}

const deletePisMutation = {
resource: metadata,
type: ‘create’,
data: ({ data }) => data,
options: {
variables: {
importStrategy: ‘DELETE’,
},
},
}

and

const deletePisMutation = {
resource: metadata,
type: ‘create’,
data: ({ data }) => data,
options: {
importStrategy: ‘DELETE’,
},
}

But none seem to work and there are no example of create mutations with options that I can find on the website.

Any help much appreciated thanks!
Pete

Hi @plinnegan ,

You can use params instead of both variables and options (which aren’t valid in a query or mutation - see the docs here), so the code would look like this:

const deletePisMutation = {
  resource: 'metadata',
  type: ‘create’,
  data: ({ data }) => data,
  params: {
    importStrategy: ‘DELETE’,
  },
}

Hope it helps!

Thanks Deborah, I think I missed this because I was looking at the useDataMutation section rather than the mutation section in the docs, this is working great thank you!

Glad to hear that Peter! It was a solution provided by @austin :tada: :ok_hand: