Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Receiving different API tags from canary server

Receiving different API tags from canary server

rminocha
Shopify Partner
6 0 1

We are using the GET /admin/api/2023-04/orders. API call and when the response comes back from the standard production platform (x-shopify-stage: production), the 'Link:' tag is capitalized.  If the response comes back from the canary platform (x-shopify-stage: canary) the 'link:' tag is not capitalized.  Our parsing program was looking specifically for 'Link:' so we were not retrieving the next page URL on canary responses due to the capitalization issue.  Is this expected behavior on the API?  Do we always have to parse for both upper and lower case to handle situations where the canary response may not include capitalizations?

 

Replies 3 (3)

beauxbreaux
Shopify Partner
263 21 45

The capitalization of HTTP headers, including the 'Link' header, is not standardized by the HTTP specification. Headers are case-insensitive, according to the HTTP/1.1 specification (RFC 7230). However, in practice, different servers and platforms may exhibit varying behavior.

In your case, it seems that the production platform returns the 'Link' header with capitalized 'L,' while the canary platform returns it with a lowercase 'l.' This is a variation in the implementation on Shopify's end.

To ensure compatibility with both cases, it's a good practice to make your parsing program case-insensitive when looking for headers. This way, it will work regardless of whether the header is in uppercase, lowercase, or a combination of both. Most programming languages provide case-insensitive methods or options for handling headers.

Adjusting your parsing logic to be case-insensitive should help you handle such situations more robustly.

Beaux Barker
Developer
Hire me on Fiverr
rminocha
Shopify Partner
6 0 1

Thanks for the reply, Beaux.  We can definitely handle the case issue.  The concern our team had was that there may be other differences between the canary platform and the standard production platform that may affect our processing.  Since only 5% or so of API calls are routed through the canary platform differences in API response processing would be sporadic and difficult to identify and correct.  Seeing the differences in HTTP header capitalization made us wonder if there are other structural changes in the canary version that would negatively affect our process.

cyrebre
Shopify Partner
1 0 0

Hi,

we have a case opened with the support regarding a bug on the "canary" platform; When calling the 'smart_collections/{smartCollectionId}/order.json' API, if the response contains "x-shopify-stage: canary" the products are not orderer correctly. 

On the header side, the response can be (case respected):

X-Shopify-Stage: production

x-shopify-stage: canary

 

Hope this can help.

 

Cyril