HTTP java request Error 403

HI all

I am new user of OSM and in a java code i obtain an HTTP eror 403. I don’t understand can you help me:
Here is the code i use:

		System.setProperty("USER.AGENT", "Application/1.0 (Java/17.0.9)");
			String st = "" + zoom + "/" + xt + "/" + yt;
		URL url = new URL("https://b.tile.openstreetmap.org/" + st + ".png");
		image = ImageIO.read(url);

zoom = 11
xt 1034
yt 713

Thanks a lot for your help.

Antonio

Valid HTTP User-Agent identifying application. Faking another app’s User-Agent WILL get you blocked. Using a library’s default User-Agent is NOT recommended. If a device automatically sends an X-Requested-With header with an application specific Application ID, this will be considered an acceptable substitute for the HTTP User-Agent, although we still recommend setting a valid HTTP User-Agent for the application.

From Tile Usage Policy

Try to remove Java part and also make sure you don’t violate any other items.

Sorry I don’t understand what you mean when you write "Try to remove Java part " or “make sure you don’t violate any other items”. Can you be more precise.
Thanks a lot for your help.

Tile Usage Policy requires you to supply

Valid HTTP User-Agent identifying application.

"Application/1.0 (Java/17.0.9)" is not identifying your application.

Please also read other parts of tile usage policy. Note that if you violated it then you can be banned for some time and you may need to wait before tile servers will handle your requests.

1 Like

Thanks a lot:

But I don’t have a good experience of this stuff like HTTP User-Agent . So I don’t know what is a correct “user-agent” for osm. The only think i want is to be able to connect to the server ```
https://b.tile.openstreetmap.org/


Thanks a lot for your help