Is there any way i can get the array of order by their ids?
Yes you can get an array of orders by their IDs using the GraphQL and rest Admin API.
Yeah the REST api will be deprecated, so you should use GraphQL as the other comment mentioned
You can get by ID or use the orders
query to paginate
Would highly recommend spending some time going through the docs to see what’s possible
rest api :
https://{{storeName}}.myshopify.com/admin/api/{{apiVersion}}/orders.json?ids=6540158927153,6541388546353
Yes, there are two ways with Shopify Admin GraphQL API
Option 1 - use query filter:
query {
orders(query: "id:2782814044317 OR id:2782813388957", first: 2) {
nodes {
id
name
}
}
}
Option 2 - use nodes query:
query {
nodes(
ids: [
"gid://shopify/Order/2782814044317"
"gid://shopify/Order/2782813388957"
]
) {
id
... on Order {
name
}
}
}
Fun fact: first query has cost of 3, while second has cost of 1