cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
139
Views
0
Helpful
1
Replies

Intersight API Region Error?

John Dorman
Cisco Employee
Cisco Employee

Howdy Folks,

I'm having an issue with the API using the Python SDK (also appears in Powershell).

I have a US-based AD automation user that has read-only web access to the instance with which I have created an API key.  The instance is located in the eu-central-1 region.

The HTTP response I get:

HTTP response body: {"code":"UnauthorizedOperation","message":"Cannot process the request. The authorization header is invalid for this API key request. Verify the API key and associated account region.","messageId":"iam_apikey_authheader_invalid","traceId":"w*****=="}

 

An invalid API key gets a different response:

HTTP response body: {"code":"AuthenticationFailure","message":"Cannot perform the operation. Invalid API key. Verify the API keyID, status, account and retry.","messageId":"iam_api_key_is_invalid","traceId":"r******=="}

 

I've tried combing through the source and help pages to find a place to specify the region with no success.
Is there someplace I can specify the region?  Or does this indicate another issue?

It seems odd, since I can login to the web GUI as the same user with no issues at all.

 

Any help would be appreciated.  Thanks!

1 Accepted Solution

Accepted Solutions

John Dorman
Cisco Employee
Cisco Employee

Just a follow up.

I was reached out to by Sandeep Kumar who helped me review the configuration I was using....and sometimes you just need another pair of eyes to see where you went wrong.

To access an account in the EU region via the Python SDK, be sure to use this reference for region to set the 'host' or 'endpoint' in the client configuration.

Bad config for EU region access:

    configuration = intersight.Configuration(
        host="https://intersight.com",
        signing_info=intersight.signing.HttpSigningConfiguration(
            key_id=api_key_id,
            private_key_path=api_secret_file,
            signing_scheme=intersight.signing.SCHEME_HS2019,
            signing_algorithm=signing_algorithm,
            hash_algorithm=intersight.signing.HASH_SHA256,
            signed_headers=[
                intersight.signing.HEADER_REQUEST_TARGET,
                intersight.signing.HEADER_HOST,
                intersight.signing.HEADER_DATE,
                intersight.signing.HEADER_DIGEST,
            ]
        )
    )

 Good Config for EU region access:

    configuration = intersight.Configuration(
        host="https://eu-central-1.intersight.com",
        signing_info=intersight.signing.HttpSigningConfiguration(
            key_id=api_key_id,
            private_key_path=api_secret_file,
            signing_scheme=intersight.signing.SCHEME_HS2019,
            signing_algorithm=signing_algorithm,
            hash_algorithm=intersight.signing.HASH_SHA256,
            signed_headers=[
                intersight.signing.HEADER_REQUEST_TARGET,
                intersight.signing.HEADER_HOST,
                intersight.signing.HEADER_DATE,
                intersight.signing.HEADER_DIGEST,
            ]
        )
    )

View solution in original post

1 Reply 1

John Dorman
Cisco Employee
Cisco Employee

Just a follow up.

I was reached out to by Sandeep Kumar who helped me review the configuration I was using....and sometimes you just need another pair of eyes to see where you went wrong.

To access an account in the EU region via the Python SDK, be sure to use this reference for region to set the 'host' or 'endpoint' in the client configuration.

Bad config for EU region access:

    configuration = intersight.Configuration(
        host="https://intersight.com",
        signing_info=intersight.signing.HttpSigningConfiguration(
            key_id=api_key_id,
            private_key_path=api_secret_file,
            signing_scheme=intersight.signing.SCHEME_HS2019,
            signing_algorithm=signing_algorithm,
            hash_algorithm=intersight.signing.HASH_SHA256,
            signed_headers=[
                intersight.signing.HEADER_REQUEST_TARGET,
                intersight.signing.HEADER_HOST,
                intersight.signing.HEADER_DATE,
                intersight.signing.HEADER_DIGEST,
            ]
        )
    )

 Good Config for EU region access:

    configuration = intersight.Configuration(
        host="https://eu-central-1.intersight.com",
        signing_info=intersight.signing.HttpSigningConfiguration(
            key_id=api_key_id,
            private_key_path=api_secret_file,
            signing_scheme=intersight.signing.SCHEME_HS2019,
            signing_algorithm=signing_algorithm,
            hash_algorithm=intersight.signing.HASH_SHA256,
            signed_headers=[
                intersight.signing.HEADER_REQUEST_TARGET,
                intersight.signing.HEADER_HOST,
                intersight.signing.HEADER_DATE,
                intersight.signing.HEADER_DIGEST,
            ]
        )
    )

Review Cisco Networking for a $25 gift card