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

Constructor Description
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

Option Type Default Description
url String '' URL of the ArcGIS service you would like to consume.
proxy String false URL of an ArcGIS API for JavaScript proxy or ArcGIS Resource Proxy to use for proxying POST requests.
useCors Boolean true If this service should use CORS when making GET requests.

Events

Event Type Description
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

Method Returns Description
get(<String> url, <Object> params, <Function> callback, <Object> context) this Makes 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) this Makes 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) this Requests the metadata about the service. This is an alias for get("/", {}, callback, context).
authenticate(<String> token) this Authenticates this service with a new token and runs any pending requests that required a token.

Edit this page on GitHub