API Order By Name returns Wrong Order

Topic summary

A developer is experiencing an issue with Shopify’s REST API order search endpoint. When querying for an order by name using the parameter name=118665-1, the API returns a different order with the name #118665-2 instead of the expected #118665-1.

Key Details:

  • The query uses the 2024-04 REST API version
  • Only one order is returned in the response, but it’s the wrong one
  • The developer expected an exact match when searching by order name

Response from Community:

  • One commenter noted that the REST API is deprecated and recommended migrating to GraphQL
  • The search functionality appears to use fuzzy matching rather than exact matching, which may explain why a similar but different order name is returned

Status: The issue remains unresolved, with the developer maintaining that even with fuzzy search, querying for -1 should return -1 rather than -2.

Summarized with AI on October 25. AI used: claude-sonnet-4-5-20250929.

https://xxx.myshopify.com/admin/api/2024-04/orders.json?name=118665-1

Returns the wrong order as shown below.

“name”: “#118665-2”,

{
“orders”: [
{
“id”: 6245016305885,
“admin_graphql_api_id”: “gid://shopify/Order/6245016305885”,
“app_id”: 157784244225,
“browser_ip”: null,
“buyer_accepts_marketing”: false,
“cancel_reason”: null,
“cancelled_at”: null,
“cart_token”: null,
“checkout_id”: null,
“checkout_token”: null,
“client_details”: null,
“closed_at”: null,
“company”: null,
“confirmation_number”: “ML6XXUZLC”,
“confirmed”: true,
“contact_email”: null,
“created_at”: “2025-08-14T20:32:32-05:00”,
“currency”: “USD”,
“current_subtotal_price”: “0.00”,
“current_subtotal_price_set”: {
“shop_money”: {
“amount”: “0.00”,
“currency_code”: “USD”
},
“presentment_money”: {
“amount”: “0.00”,
“currency_code”: “USD”
}
},
“current_total_additional_fees_set”: null,
“current_total_discounts”: “0.00”,
“current_total_discounts_set”: {
“shop_money”: {
“amount”: “0.00”,
“currency_code”: “USD”
},
“presentment_money”: {
“amount”: “0.00”,
“currency_code”: “USD”
}
},
“current_total_duties_set”: null,
“current_total_price”: “0.00”,
“current_total_price_set”: {
“shop_money”: {
“amount”: “0.00”,
“currency_code”: “USD”
},
“presentment_money”: {
“amount”: “0.00”,
“currency_code”: “USD”
}
},
“current_total_tax”: “0.00”,
“current_total_tax_set”: {
“shop_money”: {
“amount”: “0.00”,
“currency_code”: “USD”
},
“presentment_money”: {
“amount”: “0.00”,
“currency_code”: “USD”
}
},
“customer_locale”: null,
“device_id”: null,
“discount_codes”: ,
“email”: “”,
“estimated_taxes”: false,
“financial_status”: “paid”,
“fulfillment_status”: null,
“landing_site”: null,
“landing_site_ref”: null,
“location_id”: null,
“merchant_of_record_app_id”: null,
“name”: “#118665-2”,

1 Like

Hi @andyknas

You have to Explain this one by one, No one can understand what you are trying to put out

Not sure what is missing. I have a query to pull an order by name with -1 but the response JSON is an order with -2 in the name.

1 Like

Kindly provide your store URL

I had provided the web service URL

https://xxx.myshopify.com/admin/api/2024-04/orders.json?name=118665-1

Hi @andyknas

I don’t understad you at all ad your URL is error

  1. You should be migrating to GraphQL API anyway as REST is deprecated
  2. This is a search query which will return a list of possible matches and the search criteria is fuzzy – from your post quote it’s not obvious how many orders were returned.

We get a single order, the one with the -2 after it (per sample) but fuzzy or not, I would expect if I pass -1 as the name I would get -1, not -2