AW: 301 Error with https://api3.geo.admin.ch/rest/services/api/SearchServer [BGDIINF_SB-2536]

27 views
Skip to first unread message

David...@swisstopo.ch

unread,
Aug 17, 2022, 2:21:00 AM8/17/22
to geoadm...@googlegroups.com, tic...@bgdi.ch

Hi

we are analyzing withthe Team the possibility of a “transition period for http”

 

thanks for your patience

 

David

 

Von: geoadm...@googlegroups.com <geoadm...@googlegroups.com> Im Auftrag von NIS AG
Gesendet: Dienstag, 16. August 2022 10:59
An: GeoAdminCh API <geoadm...@googlegroups.com>
Betreff: Re: 301 Error with https://api3.geo.admin.ch/rest/services/api/SearchServer

 

Hello

 

In order to use https, code adjustments are required in our application. Since we have several release versions in use, this would involve considerable effort.

 

Is there a possibility that there will still be a transition period for http?

 

Regards,

Flavio

 

On Monday, August 15, 2022 at 4:56:03 AM UTC+2 christoph...@swisstopo.ch wrote:

Good morning,

 

301 is not an error but a redirect, see also statement in the response. In that case http traffic is redirected to https since we're not accepting http traffic anymore.

If you use https in your URL you end up on the service directly and receive the desired response.

 

Best regards

On Friday, August 12, 2022 at 3:59:14 PM UTC+2 David...@swisstopo.ch wrote:

Thanks

Our team will analyze it
Internal ticket

https://jira.swisstopo.ch/browse/BGDIINF_SB-2535
________________________________

Von: NIS AG <nis....@gmail.com>
Datum: 12. August 2022 um 15:50:12 MESZ
An: GeoAdminCh API <geoadm...@googlegroups.com>
Betreff: Re: 301 Error with https://api3.geo.admin.ch/rest/services/api/SearchServer

The code Snippet (Groovy/Grails) is attached.

Here the output:

DEBUG search.SwissGeocodeSearch - parameters----: type=locations&searchText=Halde 35&sr=2056
DEBUG search.SwissGeocodeSearch - url----: http://api3.geo.admin.ch/rest/services/api/SearchServer?type=locations&searchText=Halde%2035&sr=2056
DEBUG search.SwissGeocodeSearch - out----: <html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>CloudFront</center>
</body>
</html>
DEBUG search.SwissGeocodeSearch - jsonResponse----: [:]

Regards,
Flavio


On Friday, August 12, 2022 at 3:34:30 PM UTC+2 David...@swisstopo.ch wrote:
Can you provide the complete code snippet?

________________________________

Von: NIS AG <nis....@gmail.com>
Datum: 12. August 2022 um 15:17:08 MESZ
An: GeoAdminCh API <geoadm...@googlegroups.com>
Betreff: Re: 301 Error with https://api3.geo.admin.ch/rest/services/api/SearchServer

Hi David

Thank you for your prompt reply.

- In the code I tried to explicitly set the HTTP method GET and I still get the 301 error.
- We use the correct API URL: https://api3.geo.admin.ch/rest/services/api/SearchServer?type=locations&searchText=M%C3%BChlenstrasse%203,%20Villmergen&sr=2056


Regards,
Flavio

On Friday, August 12, 2022 at 1:57:08 PM UTC+2 david...@gmail.com wrote:
Hi Flavio

We did a Datencenter Migration yesterday - and the following reason for your 301 results could be

- The REST API had a bug in which all endpoints respond to any HTTP method like a GET. For the search endpoint /rest/services/api/SearchServer it has been fixed and now it only supports the correct methods:

GET => returns the data
HEAD => return only the headers (no payload)
OPTIONS => returns the headers for CORS (no payload)

See as well https://groups.google.com/g/geoadmin-api/c/Z6HMAtmhN9Q


- Versioning
Make sure that you don’t use the depreciated versioning in your code , eg a number between api3.geo.admin.ch/<http://api3.geo.admin.ch/> and /rest/

Part of the url

David

NIS AG <nis....@gmail.com> schrieb am Fr. 12. Aug. 2022 um 13:00:
Hello

Since yesterday, the calls to https://api3.geo.admin.ch/rest/services/api/SearchServer from our Webapplication are not working anymore.

Example: https://api3.geo.admin.ch/rest/services/api/SearchServer?type=locations&searchText=M%C3%BChlenstrasse%203,%20Villmergen&sr=2056
We got the error:

<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>CloudFront</center>
</body>
</html>

When calling via browser, it works, because the browser can handle the 301 error.

All the release versions of our application are affected.

Regards,
Flavio
NIS AG

--
You received this message because you are subscribed to the Google Groups "GeoAdminCh API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geoadmin-api...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geoadmin-api/2546133a-4e84-4727-9b17-68e34ce1d10en%40googlegroups.com<https://groups.google.com/d/msgid/geoadmin-api/2546133a-4e84-4727-9b17-68e34ce1d10en%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups "GeoAdminCh API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geoadmin-api...@googlegroups.com<mailto:geoadmin-api...@googlegroups.com>.
To view this discussion on the web visit https://groups.google.com/d/msgid/geoadmin-api/4175b49b-2e7f-461e-86bb-5f9045a58aden%40googlegroups.com<https://groups.google.com/d/msgid/geoadmin-api/4175b49b-2e7f-461e-86bb-5f9045a58aden%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups "GeoAdminCh API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geoadmin-api...@googlegroups.com<mailto:geoadmin-api...@googlegroups.com>.
To view this discussion on the web visit https://groups.google.com/d/msgid/geoadmin-api/19542453-c992-403d-96fe-ed42142f48b8n%40googlegroups.com<https://groups.google.com/d/msgid/geoadmin-api/19542453-c992-403d-96fe-ed42142f48b8n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups "GeoAdminCh API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geoadmin-api...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geoadmin-api/37f60053-4f91-4959-8146-a2aae7884f1en%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages