L.esri.Service

Extends L.Evented

A generic class representing a hosted resource on ArcGIS Online or ArcGIS Server. This class can be extended to provide support for making requests and serves as a standard for authentication and proxying.

Constructor

ConstructorDescription
L.esri.service(<Object>options)Options includes a url parameter which refers to the ArcGIS Server or ArcGIS Online service you would like to consume.

Options

OptionTypeDefaultDescription
urlString''URL of the ArcGIS service you would like to consume.
proxyStringfalseURL of an ArcGIS API for JavaScript proxy or ArcGIS Resource Proxy to use for proxying POST requests.
useCorsBooleantrueIf this service should use CORS when making GET requests.
timeoutNumberMilliseconds before a request to the service is automatically terminated.
requestParamsObjectnullUsed to pass through arbitrary request parameters to services.

Events

EventTypeDescription
requeststart<RequestEvent>Fired when a request to the service begins.
requestend<RequestEvent>Fired when a request to the service ends.
requestsuccess<RequestSuccessEvent>Fired when a request to the service was successful.
requesterror<RequestErrorEvent>Fired when a request to the service responsed with an error.
authenticationrequired<AuthenticationEvent>This will be fired when a request to the service fails and requires authentication.

Methods

MethodReturnsDescription
get(<String>url, <Object>params, <Function>callback, <Object>context)thisMakes a GET request to the service. The service's URL will be combined with the `path` option and parameters will be serialized to a query string. Accepts an optional function context for the callback.
post(<String>url, <Object>params, <Function>callback, <Object>context)thisMakes a POST request to the service. The service's URL will be combined with the `path` option and parameters will be serialized. Accepts an optional function context for the callback.
metadata(<Function>callback, <Object>context)thisRequests the metadata about the service. This is an alias for get("/", , callback, context).
authenticate(<String>token)thisAuthenticates this service with a new token and runs any pending requests that required a token.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.