Resolver does not return 404

79 views
Skip to first unread message

John Doherty

unread,
Jan 30, 2023, 6:21:15 AM1/30/23
to GS1 Digital Link Developers
Hello all, I've noticed that if I issue a request to the resolver for a registered GTIN, i get the expected response:

curl --location --request GET 'https://id.gs1.org/01/05060526860217?linkType=all' \
--header 'Accept: application/json'

But, if I issue a request for a GTIN I know is not registered, I get a 200 with a HTML body and not a 404 JSON response.

curl --location --request GET 'https://id.gs1.org/01/012000007897?linkType=all' \
--header 'Accept: application/json'

Which means integrating systems would need to hack around this to returning a meaningful error/next steps to users.

How are others managing this use case?

Thanks,
John

GS1 GlobalOffice

unread,
Jan 30, 2023, 6:32:54 AM1/30/23
to GS1 Digital Link Developers
Hi Jo,

Thanks for the question.

You get a 303 on the original redirect thus:

curl https://id.gs1.org/01/012000007897?linkType=all -vH "Accept: application/json"
*   Trying 51.105.227.10:443...
* Connected to id.gs1.org (51.105.227.10) port 443 (#0)
* schannel: disabled automatic use of client certificate
* ALPN: offers http/1.1
* ALPN: server accepted http/1.1
> GET /01/012000007897?linkType=all HTTP/1.1
> Host: id.gs1.org
> User-Agent: curl/7.83.1
> Accept: application/json
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 303 See Other
< Server: nginx
< Date: Mon, 30 Jan 2023 11:27:21 GMT
< Transfer-Encoding: chunked
< Connection: keep-alive
< Vary: Accept-Encoding
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: HEAD, GET, OPTIONS
< Access-Control-Expose-Headers: Link, Content-Length
< Cache-Control: max-age=0, no-cache, no-store, must-revalidate
< X-Resolver-ProcessTimeMS: 437
< Location: https://www.gs1.org/services/verified-by-gs1/results?gtin=00012000007897

So we're saying "we don't have what you asked for, but if you look over there (at the Location) you might find something useful. That 'something' is our public GTIN query. Yes, there's an annoying CAPTCHA and it's throttled to 30/day per user, but the thinking is that it's better than a straight 404? And you can detect it by looking for that initial 303 redirect.

Make sense?

Phil

John Doherty

unread,
Jan 30, 2023, 6:51:48 AM1/30/23
to GS1 Digital Link Developers
Hi Phil,

Yes, it makes sense from a consumer point of view, you want to leave them somewhere of value. But from a systems point of you (application/json), I would expect a 404.

My concern is, most request libraries automatically follow 30~ redirects, which would mean integrators need to carefully inspect/follow each response. They'll also need to write code to deal with the fact a JSON request might results in HTML.

We'll code around it for now, bit it feels like an anti-pattern that might need attention at some point.

Thanks,
John


Orca Scan Logo
John Doherty
Founder and CEO

Orca Scan Ltd. Company No: 10416637. VAT No: GB 258563765



--
You received this message because you are subscribed to a topic in the Google Groups "GS1 Digital Link Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gs1-digital-link-developers/TSCLXPe0wyI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gs1-digital-link-developers+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/gs1-digital-link-developers/f0fd57e0-0766-4126-8747-8c61cb53c63bn%40googlegroups.com.

Phil Archer

unread,
Jan 30, 2023, 7:01:38 AM1/30/23
to John Doherty, GS1 Digital Link Developers
Point taken, thanks Josh.

I might argue that rather than 404 the correct response should be 406 (https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/406) which says that content negotiation has failed to come up with an acceptable response, but yes, we should take into account the Accept header.

Noted and on the to do list.

Phil


Phil Archer
Web Solutions Director, GS1
https://www.gs1.org

Meet GS1 Digital Link Developers at
https://groups.google.com/forum/#!forum/gs1-digital-link-developers

https://philarcher.org
+44 (0)7887 767755
@philarcher1
Skype: philarcher

-----Original Message-----
From: gs1-digital-l...@googlegroups.com <gs1-digital-l...@googlegroups.com> On Behalf Of John Doherty
Sent: 30 January 2023 11:52
To: GS1 Digital Link Developers <gs1-digital-l...@googlegroups.com>
Subject: Re: [GS1 DL Devs] Resolver does not return 404

Hi Phil,


Yes, it makes sense from a consumer point of view, you want to leave them somewhere of value. But from a systems point of you (application/json), I would expect a 404.


My concern is, most request libraries automatically follow 30~ redirects, which would mean integrators need to carefully inspect/follow each response. They'll also need to write code to deal with the fact a JSON request might results in HTML.


We'll code around it for now, bit it feels like an anti-pattern that might need attention at some point.


Thanks,

John
<https://r.superhuman.com/59Tuga4qoVNx9LchER8kYSKch1wDI39fzsze5zkCCsCS5pCNj4OtDf2KW_6fokZliPC6PXjHFy4qIh_w09rhf_liuiG0XPZkTOHbt87gIxpWOb66NX7iGKhD8qCoqAAC5JLZozSH_9RyS9_YUrcvQoM21RzHKqv3aILAW9G2xCr2Q-kAwXpbmMIZ1_oYH3vww1lXYyclZe0_AjJVmi4otg.gif>


<https://orcascan.com> John Doherty
Founder and CEO
orcascan.com <https://orcascan.com>

Orca Scan Ltd. Company No: 10416637. VAT No: GB 258563765




On Mon, Jan 30, 2023 at 11:21:15, John Doherty <jo...@orcascan.com <mailto:jo...@orcascan.com> > wrote:


Hello all, I've noticed that if I issue a request to the resolver for a registered GTIN, i get the expected response:

curl --location --request GET 'https://id.gs1.org/01/05060526860217?linkType=all <https://id.gs1.org/01/05060526860217?linkType=all> ' \
--header 'Accept: application/json'

But, if I issue a request for a GTIN I know is not registered, I get a 200 with a HTML body and not a 404 JSON response.

curl --location --request GET 'https://id.gs1.org/01/012000007897?linkType=all <https://id.gs1.org/01/012000007897?linkType=all> ' \
--header 'Accept: application/json'

Which means integrating systems would need to hack around this to returning a meaningful error/next steps to users.

How are others managing this use case?

Thanks,
John



--
You received this message because you are subscribed to a topic in the Google Groups "GS1 Digital Link Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gs1-digital-link-developers/TSCLXPe0wyI/unsubscribe <https://groups.google.com/d/topic/gs1-digital-link-developers/TSCLXPe0wyI/unsubscribe> .
To unsubscribe from this group and all its topics, send an email to gs1-digital-link-de...@googlegroups.com <mailto:gs1-digital-link-de...@googlegroups.com> .
To view this discussion on the web, visit https://groups.google.com/d/msgid/gs1-digital-link-developers/f0fd57e0-0766-4126-8747-8c61cb53c63bn%40googlegroups.com <https://groups.google.com/d/msgid/gs1-digital-link-developers/f0fd57e0-0766-4126-8747-8c61cb53c63bn%40googlegroups.com?utm_medium=email&utm_source=footer> .


--
You received this message because you are subscribed to the Google Groups "GS1 Digital Link Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gs1-digital-link-de...@googlegroups.com <mailto:gs1-digital-link-de...@googlegroups.com> .
To view this discussion on the web, visit https://groups.google.com/d/msgid/gs1-digital-link-developers/ldiqsjla.8cb1662f-92c0-471f-b832-8d35c22adf29%40we.are.superhuman.com <https://groups.google.com/d/msgid/gs1-digital-link-developers/ldiqsjla.8cb1662f-92c0-471f-b832-8d35c22adf29%40we.are.superhuman.com?utm_medium=email&utm_source=footer> .

CONFIDENTIALITY / DISCLAIMER: The contents of this e-mail are confidential and are not to be regarded as a contractual offer or acceptance from GS1 (registered in Belgium).
If you are not the addressee, or if this has been copied or sent to you in error, you must not use data herein for any purpose, you must delete it, and should inform the sender.
GS1 disclaims liability for accuracy or completeness, and opinions expressed are those of the author alone.
GS1 may monitor communications.
Third party rights acknowledged.
(c) 2020.

Marc Blanchet

unread,
Jan 30, 2023, 7:03:37 AM1/30/23
to Phil Archer, John Doherty, GS1 Digital Link Developers
I would argue that this is very clearly a 404. Information is not available.

Marc.
> To unsubscribe from this group and stop receiving emails from it, send an email to gs1-digital-link-de...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/gs1-digital-link-developers/PH0PR08MB7225601DBE9943F3A9E421BFB7D39%40PH0PR08MB7225.namprd08.prod.outlook.com.

John Doherty

unread,
Jan 30, 2023, 7:15:30 AM1/30/23
to Phil Archer, GS1 Digital Link Developers
Sounds good. Thanks Phil :)


Orca Scan Logo
John Doherty
Founder and CEO
Orca Scan Ltd. Company No: 10416637. VAT No: GB 258563765

On Mon, Jan 30, 2023 at 11:21:15, John Doherty <john@orcascan.com <mailto:john@orcascan.com> > wrote:

Hello all, I've noticed that if I issue a request to the resolver for a registered GTIN, i get the expected response:

curl --location --request GET 'https://id.gs1.org/01/05060526860217?linkType=all <https://id.gs1.org/01/05060526860217?linkType=all> ' \
--header 'Accept: application/json'

But, if I issue a request for a GTIN I know is not registered, I get a 200 with a HTML body and not a 404 JSON response.

curl --location --request GET 'https://id.gs1.org/01/012000007897?linkType=all <https://id.gs1.org/01/012000007897?linkType=all> ' \
--header 'Accept: application/json'

Which means integrating systems would need to hack around this to returning a meaningful error/next steps to users.

How are others managing this use case?

Thanks,
John

--
You received this message because you are subscribed to a topic in the Google Groups "GS1 Digital Link Developers" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/gs1-digital-link-developers/TSCLXPe0wyI/unsubscribe <https://groups.google.com/d/topic/gs1-digital-link-developers/TSCLXPe0wyI/unsubscribe> . To unsubscribe from this group and all its topics, send an email to gs1-digital-link-developers+unsubscribe@googlegroups.com <mailto:gs1-digital-link-developers+unsubscribe@googlegroups.com> . To view this discussion on the web, visit https://groups.google.com/d/msgid/gs1-digital-link-developers/f0fd57e0-0766-4126-8747-8c61cb53c63bn%40googlegroups.com <https://groups.google.com/d/msgid/gs1-digital-link-developers/f0fd57e0-0766-4126-8747-8c61cb53c63bn%40googlegroups.com?utm_medium=email&utm_source=footer> .

--
You received this message because you are subscribed to the Google Groups "GS1 Digital Link Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to gs1-digital-link-developers+unsubscribe@googlegroups.com <mailto:gs1-digital-link-developers+unsubscribe@googlegroups.com> . To view this discussion on the web, visit https://groups.google.com/d/msgid/gs1-digital-link-developers/ldiqsjla.8cb1662f-92c0-471f-b832-8d35c22adf29%40we.are.superhuman.com <https://groups.google.com/d/msgid/gs1-digital-link-developers/ldiqsjla.8cb1662f-92c0-471f-b832-8d35c22adf29%40we.are.superhuman.com?utm_medium=email&utm_source=footer> .

Reply all
Reply to author
Forward
0 new messages