Graphql Bulk Operation on resources without queries

I am needing to do a bulk operation query on Fulfillments, which doesn’t have a relevant query. There are two ways I can think to go about this, though I have gotten neither to work.

First, subqueries:

mutation {
    bulkOperationRunQuery(
        query: """{
    fulfillmentOrders(query: "fulfillments.id:gid://shopify/Fulfillment/5198645887174 OR fulfillments.id:gid://shopify/Fulfillment/5198645887175 ORfulfillments.id:manyMoreIds", includeClosed: true) {
		edges {
			node {
				id
				fulfillments {
					edges {
						node {
							id
							moreFields
						}
					}
				}
			}
		}
	}
}"""
    ) {
        bulkOperation {
            id
            createdAt
            completedAt
            errorCode
            objectCount
            partialDataUrl
            type
            status
            url
        }
        userErrors {
            field
            message
        }
    }
}

When I run this, it simply pretends the query on the fulfillmentOrders doesn’t exist.

Second, bulk operation on nodes:

mutation {
    bulkOperationRunQuery(
        query: """{
	nodes(
		ids: [
			"gid://shopify/Fulfillment/1234567891234"
			"gid://shopify/Fulfillment/1234567891235"
			"gid://shopify/Fulfillment/1234567891236"
			"gid://shopify/Fulfillment/1234567891237"
			1000 more ids
		]
	) {
		... on Fulfillment {
			id
			moreFields
		}
	}
}"""
    ) {
        bulkOperation {
            id
            createdAt
            completedAt
            errorCode
            objectCount
            partialDataUrl
            type
            status
            url
        }
        userErrors {
            field
            message
        }
    }
}

This bulk operation won’t even run. I could run this outside of a bulk operation if there was only 250 ids, but I would like to be able to run an arbitrary amount of ids at once.

Is there a version of either of these that works? Or other way that I’m missing entirely?

Thanks!

Hi, there

I see a typeo in you input query.

could you share your error message ?

Option one doesn’t give an error message. It just ignores the query string and runs the query as though there was no query string. Option two gives this error message:

"userErrors": [
	{
		"field": [
			"query"
		],
		"message": "Bulk queries must contain at least one connection."
	}
]

Also, that typeo made it in when I was making the example query string for the query. It wasn’t the exact query string I used originally.

Hey @it-jkboots ,

There are a few issues I’m noticing here,

First off, the id fields are invalid fields for this query, so that is why they are being ignored. Consulting our documentation for this query, the id’s field is intended to be a range of fulfillment order id’s. I’m seeing you’ve provided fulfillment id’s.

This is an example of the proper syntax for the id field range:

fulfillmentOrders(> first: 10> query: “id:>10584555520022 id:<=10659283042326”> includeClosed: true> )

Testing further, adding that to a bulk query, it does run without any issues:

mutation BulkOperationRunQuery {> bulkOperationRunQuery(> query: “”“> {> fulfillmentOrders(> first: 10> query: “id:>10584555520022 id:<=10659283042326”> includeClosed: true> ) {> edges {> node {> id> fulfillments(first: 10) {> edges {> node {> id> }> }> }> }> }> }> }> “””> ) {> bulkOperation {> completedAt> createdAt> errorCode> fileSize> id> objectCount> partialDataUrl> query> rootObjectCount> status> type> url> }> userErrors {> field> message> }> }> }

Hope that helps,

  • Kyle G.

Very helpful.Thx

I know both examples I gave are incorrect, but they are the only ways I could think of to accomplish what I am needing. I am wondering if there is anything like the two examples I gave to accomplish what I am needing or if I am missing some solution all together. The reworked example you gave is filtering the fulfillmentOrders query based on fulfillment order ids, but I need to filter based on fulfillment ids. I have a list of fulfillment ids that I need to get the corresponding fulfillments of. I would also like to do it in a bulk operation so I can just wait for the bulk operation completed webhook and not have the app running and paging through results while the results are being found.

Hi, there

Try this in your bulk replace that 1st query.

{
  fulfillmentOrders(first:10 ,query:"id:6363733852443 OR id:6363734966555  OR id:6363743289627",
    includeClosed: true) {
    edges{
        node{
            id
            orderName
        }
        
    }
  }
}

it works in my side