> Note: > The REST Admin API is a legacy API as of October 1, 2024. All apps and integrations should be built with the [GraphQL Admin API](/docs/api/admin-graphql). For details and migration steps, visit our [migration guide](/docs/apps/build/graphql/migrate). Learn how to optimize your GraphQL implementation further by using inline fragments and building multi-query requests. ## Inline fragments Inline fragments enhance query flexibility and reusability by enabling type-specific transformations and conditional inclusion of fields. Inline fragments use the `... on ` syntax. For example, you can use the [`node`](/docs/api/admin-graphql/latest/objects/queryroot#field-queryroot-node) field on the GraphQL Admin API [`QueryRoot`](/docs/api/admin-graphql/latest/objects/queryroot) object to request specific objects by their ID. The object is returned as a generic `node` object, which doesn't let you request any information other than the ID. If you use an inline fragment, then you can ask for more specific data to return when the node is of a specific type. This is especially useful on nodes that don't have an easy access point through the `QueryRoot` object, such as a single [`LineItem`](/docs/api/admin-graphql/latest/objects/lineitem) object. You can specify multiple inline fragments, which enables you to build conditionals in your request that enable you to request different return fields based on the node type. This is useful for selections that can return many different types of fields, such as the [`nodes`](/docs/api/admin-graphql/latest/objects/queryroot#field-queryroot-nodes) connection on the GraphQL Admin API's `QueryRoot` object, which accepts an array of IDs and can return any number of different node types. ### Example The following example uses all the concepts covered so far to find where a line item is stocked so that it can be fulfilled from that location. The query uses the [`node`](/docs/api/admin-graphql/latest/objects/queryroot#field-queryroot-node) field on the [`QueryRoot`](/docs/api/admin-graphql/latest/objects/queryroot) object and provides the line item's ID. > Tip: > You can obtain a line item ID by querying the [`orders`](/docs/api/admin-graphql/latest/objects/queryroot#connection-queryroot-orders) connection on the `QueryRoot` and using the [`lineItem`](/docs/api/admin-graphql/latest/connections/LineItemConnection) connection to return a list of line item IDs.

## Make multiple queries in one request You can submit multiple queries or mutations in a single GraphQL request. This enables you to query the same field or run the name mutation multiple times with different arguments. > Note: > Submitting multiple queries or mutations in a single request doesn't provide rate-limiting benefits, because the operation complexities are additive. The syntax for submitting multiple queries has the following key elements: - At the beginning of the request, declare whether the operations are queries or mutations - Give each operation a custom alias with `: ()` - The operations don't have to be the same - Each operation must select the fields that it wants to return ## Example The following example uses multiple [`customerUpdate`](/docs/api/admin-graphql/latest/mutations/customerUpdate) mutations to set three different tags on three different customers in a single request:

## Next steps - Learn more ways to [optimize your requests](/docs/apps/build/graphql/migrate/learn-how#optimizing-your-requests). - Explore [additional guides](/docs/apps/build/graphql#additional-guides) to learn more about GraphQL at Shopify.