Snapshot Cancelation Mutation

Hello, we’re really having trouble trying to cancel some inventory snapshots with a mutation.

Previously, we were just getting back a response like we had queried for the snapshot details and the details were returned. About 10 days ago we started getting this error:

{
    "errors": [
        {
            "message": "Must provide query string."
        }
    ]
}

Since this is a mutation, I’m not sure why a query would be reqired. And why has this error message changed when nothing about our query has changed?

We’re making a post request to the graphql endpoint with the mutation and variables fields included. No query is being sent at all in this case. Now I’m second-guessing the actual post fields that the data should be submitted with, but our order creation mutations are working fine so I don’t think that’s the problem.

Here’s a log of what we are sending

Hello @OrderDesk !

Could you please share a request_id you are getting with that response with us?
You can get it by adding the field request_id inside query at the same level as data.
This will allow us to find the payload and trace the API call to respond accurately.
Have a good day!

Ignacio

I am requesting it. Here’s the full mutation from that link:

mutation {
	inventory_abort_snapshot(
		data: { snapshot_id: $snapshot_id, reason: "Too long in queue" }
	) {
		request_id
		complexity
		snapshot {
		snapshot_id
		job_user_id
		job_account_id
		warehouse_id
		customer_account_id
		notification_email
		email_error
		post_url
		post_error
		post_url_pre_check
		status
		error
		created_at
		enqueued_at
		updated_at
		snapshot_url
		snapshot_expiration
		}
	}
}

I found an example from February 2nd where we are sending the same thing and getting back a response. That request ID is 61faa7ef59aef30aee83c285.

Are we supposed to be passing an empty query field to the endpoint even if we are making a mutation call? I thought when making a mutation we pass mutation and variables fields.

Hello @OrderDesk !

Thank you for providing the query and that example.
To achieve what you are asking for, you can use the following query:

mutation {
  inventory_abort_snapshot(
    data: { snapshot_id: "6101ec157dde76cd160b9b4c" reason: "Too long in queue" }
  ) {
    request_id
    complexity
    snapshot {
      snapshot_id
      job_user_id
      job_account_id
      warehouse_id
      customer_account_id
      notification_email
      email_error
      post_url
      post_error
      post_url_pre_check
      status
      error
      created_at
      enqueued_at
      updated_at
      snapshot_url
      snapshot_expiration
    }
  }
}

About your last response. In this case, yes. It is valid to make a mutation with an empty query field (like the example posted above).
Please let me know if this doesn’t solve your concern.
Have a nice day!

Ignacio

Thanks, this works. I was trying to use a variable and it wasn’t working like I was expecting. I gave up on that and just hardcoded the value in to the query.

Thanks,

1 Like