currentBulkOperation
Returns the current app's most recent BulkOperation. Apps can run one bulk query and one bulk mutation operation at a time, by shop.
Arguments
- Anchor to typetype•Bulk
Operation Default:QUERYType The current bulk operation's type.
Anchor to Possible returnsPossible returns
- Anchor to BulkOperationBulk•
Operation An asynchronous long-running operation to fetch data in bulk or to bulk import data.
Bulk operations are created using the
or
mutation. After they are created, clients should poll the
status
field for updates. When, the
url
field contains a link to the data in JSONL format.Refer to the bulk operations guide for more details.
- completed
At •DateTime When the bulk operation was successfully completed.
- created
At •Datenon-nullTime! When the bulk operation was created.
- error
Code •BulkOperation Error Code Error code for failed operations.
- file
Size •UnsignedInt64 File size in bytes of the file in the
url
field.- id•ID!non-null
A globally-unique ID.
- object
Count •Unsignednon-nullInt64! A running count of all the objects processed. For example, when fetching all the products and their variants, this field counts both products and variants. This field can be used to track operation progress.
- partial
Data •Url URL The URL that points to the partial or incomplete response data (in JSONL format) that was returned by a failed operation. The URL expires 7 days after the operation fails. Returns
null
when there's no data available.- query•String!non-null
GraphQL query document specified in
.
- root
Object •Count Unsignednon-nullInt64! A running count of all the objects that are processed at the root of the query. For example, when fetching all the products and their variants, this field only counts products. This field can be used to track operation progress.
- status•Bulknon-null
Operation Status! Status of the bulk operation.
- type•Bulknon-null
Operation Type! The bulk operation's type.
- url•URL
The URL that points to the response data in JSONL format. The URL expires 7 days after the operation completes.
- completed
Get the currentBulkOperation for a query
query {
currentBulkOperation(type: QUERY) {
id
type
status
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "query { currentBulkOperation(type: QUERY) { id type status } }"
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
currentBulkOperation(type: QUERY) {
id
type
status
}
}`,
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `query {
currentBulkOperation(type: QUERY) {
id
type
status
}
}`,
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
query {
currentBulkOperation(type: QUERY) {
id
type
status
}
}
QUERY
response = client.query(query: query)