L.esri.Service

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

Constructor

Constructor Description
new L.esri.Services.Service(<String> url, <Object> options)

L.esri.Services.service(<String> url, <Object> options)
The url parameter is the URL to the ArcGIS Server or ArcGIS Online service you would like to consume.

Options

Option Type Default Description
proxy String false URL of an ArcGIS API for JavaScript proxies or ArcGIS Resource Proxies 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. See working with authenticated services for more information.

Methods

Method Returns Description
get(<String> url, <Object> params, <Function> callback, <Object> context) this Makes a GET request to the service. The services 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 services 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