Namespace: service

alk.service

This namespace contains classes for objects that act as alk.service.Service objects. Service objects are primarily used to generate URLs based on options using alk.service.Service#getURL. They have additional calls. Firstly, the method alk.service.Service#get performs an XHR request on the endpoint pointed to by alk.service.Service#getURL. Also, alk.service.Service#getAttribution, if applicable to the service, will get the attribution string.

Classes

AvoidFavorSetsService
AvoidFavorsService
CountriesSingleSearchService
CustomCategoriesService
CustomPlaceSetsService
CustomPlacesService
DriveTimePolygonService
LocationsReverseService
LocationsService
MapTileService
MultipleServiceRequestEngine
POICategoriesSingleSearchService
POIService
PolygonsCountyService
RestService
RoadSurfaceRouteService
RoadSurfaceTileService
RoutePathService
RouteReportsService
RouteService
SearchSingleSearchService
SearchTypesSingleSearchService
Service
ServiceBase
StatesSingleSearchService
TrafficCameraMetadataService
TrafficCamerasService
TrafficIncidentsService
TrafficTileService
WeatherAlertsService
WeatherImageTileService

Methods

alk.service.setArgCheck(onoff){boolean}

This method turns on a feature that will throw an exception if any of values of the service parameters do not match or are equivalent to their alk.val counter parts.

The service parameters are used in constructing URLs for ALK services. We attempt to check the names and values of the arguments you give to an alk.service as a malformed value may not always lead to a noticeable error response.

Name Type Description
onoff boolean

A boolean of true is on.

Returns:
The previous value;
Examples
alk.service.setArgCheck(true);
alk.service.MapTileService({
   style: "night"
);

The above example will throw an error at URL generation time, because the
proper value to use is alk.val.Style.Night, which is equal to "Night".
Case matters.

If the argument check is set to false, and the item will not be checked
for validity, and it will be silently ignored.

Keep in mind that a parameter name may be mapped to something else and value may
not always be relevant to the particular service and therefor ignored.
For example, "apiKey" is mapped to "authToken" in most PCMiler Web Services.
alk.service.setArgCheck(false);
alk.service.MapTileService({
   apiKey: "1234",
   style: "night"
);

would generate a URL similar to the following:

http://pcmiler.alk.com/apis/rest/v1.0/service.svc/maptile?authToken=1234&x=0&y=0&z=0.

and therefore you would get the "Default" style as a matter of the
Server's default.

Please see alk.service.setArgPermissive to let unchecked
values through to the service parameters.
alk.service.setArgCheck(false);
alk.service.setArgPermissive(true);
alk.service.MapTileService({
   apiKey: "1234",
   style: "night"
);

would generate the URL similar to the following:

http://pcmiler.alk.com/apis/rest/v1.0/service.svc/maptile?style=night&authToken=1234&x=0&y=0&z=0.

and therefore you may get the "Default" style as a matter of the
Server's default because the server does't know about "night",
you may get an HTTP 500 error, bad request depending on the service.

alk.service.setArgPermissive(onoff){boolean}

This method turns on a feature that will allow non-standard values for certain parameters. This feature, if used with alk.service.setArgCheck(false), will allow non standard values. This approach may be good for development and experimentation where checked values have not yet been assigned.

Name Type Description
onoff boolean

A boolean of true is on.

Returns:
The previous value.
Example
alk.service.setArgPermissive(true);
alk.service.MapTileService({
   style: "new-style-2"
);

The above example would generate a PC Miler maptile URL of
http://pcmiler.alk.com/apis/rest/v1.0/service.svc/maptile?style=new-style-2&AuthToken=233423432&x=0&y=0&z=0.
Case matters.