Accessing experimental features of xLocate server

This forum deals with any kind of web based client technology, whether it is the well known java script based Ajax servlet or the upcoming approaches such as Leaflet, OpenLayers and so on.
Post Reply
kgrudzinski
Posts: 12
Joined: Fri Feb 19, 2016 10:56 am

Accessing experimental features of xLocate server

Post by kgrudzinski »

Hello,

Is there a way to access experimental features of xLocate server by means of XLocateClient? I could not find in documentation how to include xlocate-client.js.
matthias

Re: Accessing experimental features of xLocate server

Post by matthias »

With the 2.0 Release of xServer it is unfortunatly not possible to access the experimental features using the deployed client. You will have to access it yourself using tools like jquery. See the documentation in section Developers Guide -> Using xserver with Javascript -> Generating clients. Make sure you use the experimental URL like http://your_server_ip:port/services/rs/XLocate/experimental.

The good news is that starting with the 2.1 release it will be possible to use the deployed client with experimental APIs! Then you can simply create the client like this:

var xlocate = new XLocateClient("experimental");

Best regards,
Matthias
kgrudzinski
Posts: 12
Joined: Fri Feb 19, 2016 10:56 am

Re: Accessing experimental features of xLocate server

Post by kgrudzinski »

I have a follow up question. I am using PTV xServer INTERNET so I replaced http://your_server_ip:port/ from Your answer with https://xserver2-europe-test.cloud.ptvgroup.com/ and I am getting 403 forbidden error. I suspect it is caused by bad authentication. I followed this example but it does not seem to work.
My code looks like this:

Code: Select all

var newSearch = function(locateUrl, text, token) {
		var url = locateUrl+'locations/'+text;
		
		$.ajax({
			url: url,
			type: "GET",
			headers: {
				"Authorization": "Basic " + btoa("xtok:" + token)
			},
	 
			success: function(data, status, xhr) { 
				console.log(data); 
			},
	 
			error: function(xhr, status, error) { 
				console.log(error); 
			}
		});
		
}
What is the proper way of authenticating my request?
f.gailfuß
Posts: 8
Joined: Fri Sep 16, 2016 8:02 am

Re: Accessing experimental features of xLocate server

Post by f.gailfuß »

Basic authentication is used for POST requests; For GET requests, the token is simply provided through the request parameter "xtok" like this:

https://xserver2-europe-test.cloud.ptvg ... our-token>

Best regards,
Frank
Frank Gailfuß
PTV GROUP Germany
kgrudzinski
Posts: 12
Joined: Fri Feb 19, 2016 10:56 am

Re: Accessing experimental features of xLocate server

Post by kgrudzinski »

Everything works now. Thank you for your help.
Post Reply