UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

30 lines (29 loc) 1.67 kB
export interface APIKeyMixinProperties extends Partial<Pick<APIKeyMixin, "apiKey">> {} /** * APIKeyMixin adds an `apiKey` property to layers and ensures that the key is included in all outgoing requests performed by those layers. * * @since 4.20 */ export abstract class APIKeyMixin { constructor(...args: any[]); /** * An authorization string used to access a resource or service. * This property will append the API key to all requests made by the layer to the service. * [API keys](https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/) are generated and managed in the portal. * An API key is tied explicitly to an ArcGIS account; it is also used to monitor service usage. * Setting a fine-grained API key on a specific class overrides the [global API key](https://developers.arcgis.com/javascript/latest/references/core/config/#Config-apiKey). * * If loading a secure layer with API authentication via a [PortalItem](https://developers.arcgis.com/javascript/latest/references/core/portal/PortalItem/), the API key needs to be set on the layer's `portalItem` property. * * @since 4.20 * @see [Item access privileges](https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/api-key-credentials/#item-access-privileges) * @see [API key guide](https://developers.arcgis.com/javascript/latest/secure-resources/#api-keys) * @example * // set the api key to access a protected service * const layer = new FeatureLayer({ * url: serviceUrl, * apiKey: "YOUR_API_KEY" * }); */ accessor apiKey: string | null | undefined; }