Amazon Location Service

2023/02/23 - Amazon Location Service - 5 new 4 updated api methods

Changes  This release adds support for using Maps APIs with an API Key in addition to AWS Cognito. This includes support for adding, listing, updating and deleting API Keys.

DeleteKey (new) Link ¶

Deletes the specified API key. The API key must have been deactivated more than 90 days previously.

See also: AWS API Documentation

Request Syntax

client.delete_key(
    KeyName='string'
)
type KeyName

string

param KeyName

[REQUIRED]

The name of the API key to delete.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

DescribeKey (new) Link ¶

Retrieves the API key resource details.

Warning

The API keys feature is in preview. We may add, change, or remove features before announcing general availability. For more information, see Using API keys.

See also: AWS API Documentation

Request Syntax

client.describe_key(
    KeyName='string'
)
type KeyName

string

param KeyName

[REQUIRED]

The name of the API key resource.

rtype

dict

returns

Response Syntax

{
    'CreateTime': datetime(2015, 1, 1),
    'Description': 'string',
    'ExpireTime': datetime(2015, 1, 1),
    'Key': 'string',
    'KeyArn': 'string',
    'KeyName': 'string',
    'Restrictions': {
        'AllowActions': [
            'string',
        ],
        'AllowReferers': [
            'string',
        ],
        'AllowResources': [
            'string',
        ]
    },
    'Tags': {
        'string': 'string'
    },
    'UpdateTime': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • CreateTime (datetime) --

      The timestamp for when the API key resource was created in ISO 8601 format: YYYY-MM-DDThh:mm:ss.sssZ .

    • Description (string) --

      The optional description for the API key resource.

    • ExpireTime (datetime) --

      The timestamp for when the API key resource will expire in ISO 8601 format: YYYY-MM-DDThh:mm:ss.sssZ .

    • Key (string) --

      The key value/string of an API key.

    • KeyArn (string) --

      The Amazon Resource Name (ARN) for the API key resource. Used when you need to specify a resource across all Amazon Web Services.

      • Format example: arn:aws:geo:region:account-id:key/ExampleKey

    • KeyName (string) --

      The name of the API key resource.

    • Restrictions (dict) --

      API Restrictions on the allowed actions, resources, and referers for an API key resource.

      • AllowActions (list) --

        A list of allowed actions that an API key resource grants permissions to perform

        Note

        Currently, the only valid action is geo:GetMap* as an input to the list. For example, ["geo:GetMap*"] is valid but ["geo:GetMapTile"] is not.

        • (string) --

      • AllowReferers (list) --

        An optional list of allowed HTTP referers for which requests must originate from. Requests using this API key from other domains will not be allowed.

        Requirements:

        • Contain only alphanumeric characters (A–Z, a–z, 0–9) or any symbols in this list $\-._+!*`(),;/?:@=&

        • May contain a percent (%) if followed by 2 hexadecimal digits (A-F, a-f, 0-9); this is used for URL encoding purposes.

        • May contain wildcard characters question mark (?) and asterisk (*). Question mark (?) will replace any single character (including hexadecimal digits). Asterisk (*) will replace any multiple characters (including multiple hexadecimal digits).

        • No spaces allowed. For example, https://example.com .

        • (string) --

      • AllowResources (list) --

        A list of allowed resource ARNs that a API key bearer can perform actions on

        For more information about ARN format, see Amazon Resource Names (ARNs).

        Note

        In this preview, you can allow only map resources.

        Requirements:

        • Must be prefixed with arn .

        • partition and service must not be empty and should begin with only alphanumeric characters (A–Z, a–z, 0–9) and contain only alphanumeric numbers, hyphens (-) and periods (.).

        • region and account-id can be empty or should begin with only alphanumeric characters (A–Z, a–z, 0–9) and contain only alphanumeric numbers, hyphens (-) and periods (.).

        • resource-id can begin with any character except for forward slash (/) and contain any characters after, including forward slashes to form a path. resource-id can also include wildcard characters, denoted by an asterisk (*).

        • arn , partition , service , region , account-id and resource-id must be delimited by a colon (:).

        • No spaces allowed. For example, arn:aws:geo:region:account-id:map/ExampleMap* .

        • (string) --

    • Tags (dict) --

      Tags associated with the API key resource.

      • (string) --

        • (string) --

    • UpdateTime (datetime) --

      The timestamp for when the API key resource was last updated in ISO 8601 format: YYYY-MM-DDThh:mm:ss.sssZ .

ListKeys (new) Link ¶

Lists API key resources in your Amazon Web Services account.

Warning

The API keys feature is in preview. We may add, change, or remove features before announcing general availability. For more information, see Using API keys.

See also: AWS API Documentation

Request Syntax

client.list_keys(
    Filter={
        'KeyStatus': 'Active'|'Expired'
    },
    MaxResults=123,
    NextToken='string'
)
type Filter

dict

param Filter

Optionally filter the list to only Active or Expired API keys.

  • KeyStatus (string) --

    Filter on Active or Expired API keys.

type MaxResults

integer

param MaxResults

An optional limit for the number of resources returned in a single call.

Default value: 100

type NextToken

string

param NextToken

The pagination token specifying which page of results to return in the response. If no token is provided, the default page is the first page.

Default value: null

rtype

dict

returns

Response Syntax

{
    'Entries': [
        {
            'CreateTime': datetime(2015, 1, 1),
            'Description': 'string',
            'ExpireTime': datetime(2015, 1, 1),
            'KeyName': 'string',
            'Restrictions': {
                'AllowActions': [
                    'string',
                ],
                'AllowReferers': [
                    'string',
                ],
                'AllowResources': [
                    'string',
                ]
            },
            'UpdateTime': datetime(2015, 1, 1)
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Entries (list) --

      Contains API key resources in your Amazon Web Services account. Details include API key name, allowed referers and timestamp for when the API key will expire.

      • (dict) --

        An API key resource listed in your Amazon Web Services account.

        • CreateTime (datetime) --

          The timestamp of when the API key was created, in ISO 8601 format: YYYY-MM-DDThh:mm:ss.sssZ .

        • Description (string) --

          The optional description for the API key resource.

        • ExpireTime (datetime) --

          The timestamp for when the API key resource will expire, in ISO 8601 format: YYYY-MM-DDThh:mm:ss.sssZ .

        • KeyName (string) --

          The name of the API key resource.

        • Restrictions (dict) --

          API Restrictions on the allowed actions, resources, and referers for an API key resource.

          • AllowActions (list) --

            A list of allowed actions that an API key resource grants permissions to perform

            Note

            Currently, the only valid action is geo:GetMap* as an input to the list. For example, ["geo:GetMap*"] is valid but ["geo:GetMapTile"] is not.

            • (string) --

          • AllowReferers (list) --

            An optional list of allowed HTTP referers for which requests must originate from. Requests using this API key from other domains will not be allowed.

            Requirements:

            • Contain only alphanumeric characters (A–Z, a–z, 0–9) or any symbols in this list $\-._+!*`(),;/?:@=&

            • May contain a percent (%) if followed by 2 hexadecimal digits (A-F, a-f, 0-9); this is used for URL encoding purposes.

            • May contain wildcard characters question mark (?) and asterisk (*). Question mark (?) will replace any single character (including hexadecimal digits). Asterisk (*) will replace any multiple characters (including multiple hexadecimal digits).

            • No spaces allowed. For example, https://example.com .

            • (string) --

          • AllowResources (list) --

            A list of allowed resource ARNs that a API key bearer can perform actions on

            For more information about ARN format, see Amazon Resource Names (ARNs).

            Note

            In this preview, you can allow only map resources.

            Requirements:

            • Must be prefixed with arn .

            • partition and service must not be empty and should begin with only alphanumeric characters (A–Z, a–z, 0–9) and contain only alphanumeric numbers, hyphens (-) and periods (.).

            • region and account-id can be empty or should begin with only alphanumeric characters (A–Z, a–z, 0–9) and contain only alphanumeric numbers, hyphens (-) and periods (.).

            • resource-id can begin with any character except for forward slash (/) and contain any characters after, including forward slashes to form a path. resource-id can also include wildcard characters, denoted by an asterisk (*).

            • arn , partition , service , region , account-id and resource-id must be delimited by a colon (:).

            • No spaces allowed. For example, arn:aws:geo:region:account-id:map/ExampleMap* .

            • (string) --

        • UpdateTime (datetime) --

          The timestamp of when the API key was last updated, in ISO 8601 format: YYYY-MM-DDThh:mm:ss.sssZ .

    • NextToken (string) --

      A pagination token indicating there are additional pages available. You can use the token in a following request to fetch the next set of results.

UpdateKey (new) Link ¶

Updates the specified properties of a given API key resource.

Warning

The API keys feature is in preview. We may add, change, or remove features before announcing general availability. For more information, see Using API keys.

See also: AWS API Documentation

Request Syntax

client.update_key(
    Description='string',
    ExpireTime=datetime(2015, 1, 1),
    ForceUpdate=True|False,
    KeyName='string',
    NoExpiry=True|False,
    Restrictions={
        'AllowActions': [
            'string',
        ],
        'AllowReferers': [
            'string',
        ],
        'AllowResources': [
            'string',
        ]
    }
)
type Description

string

param Description

Updates the description for the API key resource.

type ExpireTime

datetime

param ExpireTime

Updates the timestamp for when the API key resource will expire in ISO 8601 format: YYYY-MM-DDThh:mm:ss.sssZ .

type ForceUpdate

boolean

param ForceUpdate

The boolean flag to be included for updating ExpireTime or Restrictions details.

Must be set to true to update an API key resource that has been used in the past 7 days.

False if force update is not preferred

Default value: False

type KeyName

string

param KeyName

[REQUIRED]

The name of the API key resource to update.

type NoExpiry

boolean

param NoExpiry

Whether the API key should expire. Set to true to set the API key to have no expiration time.

type Restrictions

dict

param Restrictions

Updates the API key restrictions for the API key resource.

  • AllowActions (list) -- [REQUIRED]

    A list of allowed actions that an API key resource grants permissions to perform

    Note

    Currently, the only valid action is geo:GetMap* as an input to the list. For example, ["geo:GetMap*"] is valid but ["geo:GetMapTile"] is not.

    • (string) --

  • AllowReferers (list) --

    An optional list of allowed HTTP referers for which requests must originate from. Requests using this API key from other domains will not be allowed.

    Requirements:

    • Contain only alphanumeric characters (A–Z, a–z, 0–9) or any symbols in this list $\-._+!*`(),;/?:@=&

    • May contain a percent (%) if followed by 2 hexadecimal digits (A-F, a-f, 0-9); this is used for URL encoding purposes.

    • May contain wildcard characters question mark (?) and asterisk (*). Question mark (?) will replace any single character (including hexadecimal digits). Asterisk (*) will replace any multiple characters (including multiple hexadecimal digits).

    • No spaces allowed. For example, https://example.com .

    • (string) --

  • AllowResources (list) -- [REQUIRED]

    A list of allowed resource ARNs that a API key bearer can perform actions on

    For more information about ARN format, see Amazon Resource Names (ARNs).

    Note

    In this preview, you can allow only map resources.

    Requirements:

    • Must be prefixed with arn .

    • partition and service must not be empty and should begin with only alphanumeric characters (A–Z, a–z, 0–9) and contain only alphanumeric numbers, hyphens (-) and periods (.).

    • region and account-id can be empty or should begin with only alphanumeric characters (A–Z, a–z, 0–9) and contain only alphanumeric numbers, hyphens (-) and periods (.).

    • resource-id can begin with any character except for forward slash (/) and contain any characters after, including forward slashes to form a path. resource-id can also include wildcard characters, denoted by an asterisk (*).

    • arn , partition , service , region , account-id and resource-id must be delimited by a colon (:).

    • No spaces allowed. For example, arn:aws:geo:region:account-id:map/ExampleMap* .

    • (string) --

rtype

dict

returns

Response Syntax

{
    'KeyArn': 'string',
    'KeyName': 'string',
    'UpdateTime': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • KeyArn (string) --

      The Amazon Resource Name (ARN) for the API key resource. Used when you need to specify a resource across all Amazon Web Services.

      • Format example: arn:aws:geo:region:account-id:key/ExampleKey

    • KeyName (string) --

      The name of the API key resource.

    • UpdateTime (datetime) --

      The timestamp for when the API key resource was last updated in ISO 8601 format: YYYY-MM-DDThh:mm:ss.sssZ .

CreateKey (new) Link ¶

Creates an API key resource in your Amazon Web Services account, which lets you grant geo:GetMap* actions for Amazon Location Map resources to the API key bearer.

Warning

The API keys feature is in preview. We may add, change, or remove features before announcing general availability. For more information, see Using API keys.

See also: AWS API Documentation

Request Syntax

client.create_key(
    Description='string',
    ExpireTime=datetime(2015, 1, 1),
    KeyName='string',
    NoExpiry=True|False,
    Restrictions={
        'AllowActions': [
            'string',
        ],
        'AllowReferers': [
            'string',
        ],
        'AllowResources': [
            'string',
        ]
    },
    Tags={
        'string': 'string'
    }
)
type Description

string

param Description

An optional description for the API key resource.

type ExpireTime

datetime

param ExpireTime

The optional timestamp for when the API key resource will expire in ISO 8601 format: YYYY-MM-DDThh:mm:ss.sssZ . One of NoExpiry or ExpireTime must be set.

type KeyName

string

param KeyName

[REQUIRED]

A custom name for the API key resource.

Requirements:

  • Contain only alphanumeric characters (A–Z, a–z, 0–9), hyphens (-), periods (.), and underscores (_).

  • Must be a unique API key name.

  • No spaces allowed. For example, ExampleAPIKey .

type NoExpiry

boolean

param NoExpiry

Optionally set to true to set no expiration time for the API key. One of NoExpiry or ExpireTime must be set.

type Restrictions

dict

param Restrictions

[REQUIRED]

The API key restrictions for the API key resource.

  • AllowActions (list) -- [REQUIRED]

    A list of allowed actions that an API key resource grants permissions to perform

    Note

    Currently, the only valid action is geo:GetMap* as an input to the list. For example, ["geo:GetMap*"] is valid but ["geo:GetMapTile"] is not.

    • (string) --

  • AllowReferers (list) --

    An optional list of allowed HTTP referers for which requests must originate from. Requests using this API key from other domains will not be allowed.

    Requirements:

    • Contain only alphanumeric characters (A–Z, a–z, 0–9) or any symbols in this list $\-._+!*`(),;/?:@=&

    • May contain a percent (%) if followed by 2 hexadecimal digits (A-F, a-f, 0-9); this is used for URL encoding purposes.

    • May contain wildcard characters question mark (?) and asterisk (*). Question mark (?) will replace any single character (including hexadecimal digits). Asterisk (*) will replace any multiple characters (including multiple hexadecimal digits).

    • No spaces allowed. For example, https://example.com .

    • (string) --

  • AllowResources (list) -- [REQUIRED]

    A list of allowed resource ARNs that a API key bearer can perform actions on

    For more information about ARN format, see Amazon Resource Names (ARNs).

    Note

    In this preview, you can allow only map resources.

    Requirements:

    • Must be prefixed with arn .

    • partition and service must not be empty and should begin with only alphanumeric characters (A–Z, a–z, 0–9) and contain only alphanumeric numbers, hyphens (-) and periods (.).

    • region and account-id can be empty or should begin with only alphanumeric characters (A–Z, a–z, 0–9) and contain only alphanumeric numbers, hyphens (-) and periods (.).

    • resource-id can begin with any character except for forward slash (/) and contain any characters after, including forward slashes to form a path. resource-id can also include wildcard characters, denoted by an asterisk (*).

    • arn , partition , service , region , account-id and resource-id must be delimited by a colon (:).

    • No spaces allowed. For example, arn:aws:geo:region:account-id:map/ExampleMap* .

    • (string) --

type Tags

dict

param Tags

Applies one or more tags to the map resource. A tag is a key-value pair that helps manage, identify, search, and filter your resources by labelling them.

Format: "key" : "value"

Restrictions:

  • Maximum 50 tags per resource

  • Each resource tag must be unique with a maximum of one value.

  • Maximum key length: 128 Unicode characters in UTF-8

  • Maximum value length: 256 Unicode characters in UTF-8

  • Can use alphanumeric characters (A–Z, a–z, 0–9), and the following characters: + - = . _ : / @.

  • Cannot use "aws:" as a prefix for a key.

  • (string) --

    • (string) --

rtype

dict

returns

Response Syntax

{
    'CreateTime': datetime(2015, 1, 1),
    'Key': 'string',
    'KeyArn': 'string',
    'KeyName': 'string'
}

Response Structure

  • (dict) --

    • CreateTime (datetime) --

      The timestamp for when the API key resource was created in ISO 8601 format: YYYY-MM-DDThh:mm:ss.sssZ .

    • Key (string) --

      The key value/string of an API key. This value is used when making API calls to authorize the call. For example, see GetMapGlyphs.

    • KeyArn (string) --

      The Amazon Resource Name (ARN) for the API key resource. Used when you need to specify a resource across all Amazon Web Services.

      • Format example: arn:aws:geo:region:account-id:key/ExampleKey

    • KeyName (string) --

      The name of the API key resource.

GetMapGlyphs (updated) Link ¶
Changes (request, response)
Request
{'Key': 'string'}
Response
{'CacheControl': 'string'}

Retrieves glyphs used to display labels on a map.

See also: AWS API Documentation

Request Syntax

client.get_map_glyphs(
    FontStack='string',
    FontUnicodeRange='string',
    Key='string',
    MapName='string'
)
type FontStack

string

param FontStack

[REQUIRED]

A comma-separated list of fonts to load glyphs from in order of preference. For example, Noto Sans Regular, Arial Unicode .

Valid fonts stacks for Esri styles:

  • VectorEsriDarkGrayCanvas – Ubuntu Medium Italic | Ubuntu Medium | Ubuntu Italic | Ubuntu Regular | Ubuntu Bold

  • VectorEsriLightGrayCanvas – Ubuntu Italic | Ubuntu Regular | Ubuntu Light | Ubuntu Bold

  • VectorEsriTopographic – Noto Sans Italic | Noto Sans Regular | Noto Sans Bold | Noto Serif Regular | Roboto Condensed Light Italic

  • VectorEsriStreets – Arial Regular | Arial Italic | Arial Bold

  • VectorEsriNavigation – Arial Regular | Arial Italic | Arial Bold

Valid font stacks for HERE Technologies styles:

  • VectorHereContrast – Fira GO Regular | Fira GO Bold

  • VectorHereExplore, VectorHereExploreTruck, HybridHereExploreSatellite – Fira GO Italic | Fira GO Map | Fira GO Map Bold | Noto Sans CJK JP Bold | Noto Sans CJK JP Light | Noto Sans CJK JP Regular

Valid font stacks for GrabMaps styles:

  • VectorGrabStandardLight, VectorGrabStandardDark – Noto Sans Regular | Noto Sans Medium | Noto Sans Bold

Valid font stacks for Open Data (Preview) styles:

  • VectorOpenDataStandardLight – Amazon Ember Regular,Noto Sans Regular | Amazon Ember Bold,Noto Sans Bold | Amazon Ember Medium,Noto Sans Medium | Amazon Ember Regular Italic,Noto Sans Italic | Amazon Ember Condensed RC Regular,Noto Sans Regular | Amazon Ember Condensed RC Bold,Noto Sans Bold

Note

The fonts used by VectorOpenDataStandardLight are combined fonts that use Amazon Ember for most glyphs but Noto Sans for glyphs unsupported by Amazon Ember .

type FontUnicodeRange

string

param FontUnicodeRange

[REQUIRED]

A Unicode range of characters to download glyphs for. Each response will contain 256 characters. For example, 0–255 includes all characters from range U+0000 to 00FF . Must be aligned to multiples of 256.

type Key

string

param Key

The optional API key to authorize the request.

type MapName

string

param MapName

[REQUIRED]

The map resource associated with the glyph file.

rtype

dict

returns

Response Syntax

{
    'Blob': StreamingBody(),
    'CacheControl': 'string',
    'ContentType': 'string'
}

Response Structure

  • (dict) --

    • Blob (:class:`.StreamingBody`) --

      The glyph, as binary blob.

    • CacheControl (string) --

      The HTTP Cache-Control directive for the value.

    • ContentType (string) --

      The map glyph content type. For example, application/octet-stream .

GetMapSprites (updated) Link ¶
Changes (request, response)
Request
{'Key': 'string'}
Response
{'CacheControl': 'string'}

Retrieves the sprite sheet corresponding to a map resource. The sprite sheet is a PNG image paired with a JSON document describing the offsets of individual icons that will be displayed on a rendered map.

See also: AWS API Documentation

Request Syntax

client.get_map_sprites(
    FileName='string',
    Key='string',
    MapName='string'
)
type FileName

string

param FileName

[REQUIRED]

The name of the sprite file. Use the following file names for the sprite sheet:

  • sprites.png

  • sprites@2x.png for high pixel density displays

For the JSON document containing image offsets. Use the following file names:

  • sprites.json

  • sprites@2x.json for high pixel density displays

type Key

string

param Key

The optional API key to authorize the request.

type MapName

string

param MapName

[REQUIRED]

The map resource associated with the sprite file.

rtype

dict

returns

Response Syntax

{
    'Blob': StreamingBody(),
    'CacheControl': 'string',
    'ContentType': 'string'
}

Response Structure

  • (dict) --

    • Blob (:class:`.StreamingBody`) --

      Contains the body of the sprite sheet or JSON offset file.

    • CacheControl (string) --

      The HTTP Cache-Control directive for the value.

    • ContentType (string) --

      The content type of the sprite sheet and offsets. For example, the sprite sheet content type is image/png , and the sprite offset JSON document is application/json .

GetMapStyleDescriptor (updated) Link ¶
Changes (request, response)
Request
{'Key': 'string'}
Response
{'CacheControl': 'string'}

Retrieves the map style descriptor from a map resource.

The style descriptor contains specifications on how features render on a map. For example, what data to display, what order to display the data in, and the style for the data. Style descriptors follow the Mapbox Style Specification.

See also: AWS API Documentation

Request Syntax

client.get_map_style_descriptor(
    Key='string',
    MapName='string'
)
type Key

string

param Key

The optional API key to authorize the request.

type MapName

string

param MapName

[REQUIRED]

The map resource to retrieve the style descriptor from.

rtype

dict

returns

Response Syntax

{
    'Blob': StreamingBody(),
    'CacheControl': 'string',
    'ContentType': 'string'
}

Response Structure

  • (dict) --

    • Blob (:class:`.StreamingBody`) --

      Contains the body of the style descriptor.

    • CacheControl (string) --

      The HTTP Cache-Control directive for the value.

    • ContentType (string) --

      The style descriptor's content type. For example, application/json .

GetMapTile (updated) Link ¶
Changes (request, response)
Request
{'Key': 'string'}
Response
{'CacheControl': 'string'}

Retrieves a vector data tile from the map resource. Map tiles are used by clients to render a map. they're addressed using a grid arrangement with an X coordinate, Y coordinate, and Z (zoom) level.

The origin (0, 0) is the top left of the map. Increasing the zoom level by 1 doubles both the X and Y dimensions, so a tile containing data for the entire world at (0/0/0) will be split into 4 tiles at zoom 1 (1/0/0, 1/0/1, 1/1/0, 1/1/1).

See also: AWS API Documentation

Request Syntax

client.get_map_tile(
    Key='string',
    MapName='string',
    X='string',
    Y='string',
    Z='string'
)
type Key

string

param Key

The optional API key to authorize the request.

type MapName

string

param MapName

[REQUIRED]

The map resource to retrieve the map tiles from.

type X

string

param X

[REQUIRED]

The X axis value for the map tile.

type Y

string

param Y

[REQUIRED]

The Y axis value for the map tile.

type Z

string

param Z

[REQUIRED]

The zoom value for the map tile.

rtype

dict

returns

Response Syntax

{
    'Blob': StreamingBody(),
    'CacheControl': 'string',
    'ContentType': 'string'
}

Response Structure

  • (dict) --

    • Blob (:class:`.StreamingBody`) --

      Contains Mapbox Vector Tile (MVT) data.

    • CacheControl (string) --

      The HTTP Cache-Control directive for the value.

    • ContentType (string) --

      The map tile's content type. For example, application/vnd.mapbox-vector-tile .