Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

try to run python code with python sdk  of opsgiene   to create opsgiene alarm in aws lambda

i try to run python code with python sdk  of opsgiene   to create opsgiene alarm in aws lambda but i get that error :

"errorMessage": "You are not authorized to perform this action: (401)\nReason: Unauthorized: apiKey is invalid or integration is disabled\nHTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json', 'Content-Length': '98', 'Connection': 'keep-alive', 'Date': 'Sun, 05 Dec 2021 21:11:20 GMT', 'X-Request-Id': 'b67d7a41-5be4-4eb3-b869-945e1330a85e', 'X-Response-Time': '0.0', 'Og-Apigw-Request-Id': 'fa4076ab-2eef-4c40-8ea9-88b7240ec1ac', 'X-Envoy-Upstream-Service-Time': '129', 'Expect-Ct': 'report-uri=\" ", max-age=86400', 'Strict-Transport-Security': 'max-age=63072000; preload', 'X-Content-Type-Options': 'nosniff', 'X-Xss-Protection': '1; mode=block', 'Atl-Traceid': 'a7cbcab36b582704', 'Report-To': '{\"group\": \"endpoint-1\", \"max_age\": 600, \"endpoints\": [{\"url\": \" \"}], \"include_subdomains\": true}', 'Nel': '{\"report_to\": \"endpoint-1\", \"max_age\": 600, \"include_subdomains\": true, \"failure_fraction\": 0.001}', 'Server': 'globaledge-envoy', 'X-Cache': 'Error from cloudfront', 'Via': '1.1 591fc133cda27edbedf7edb3f0231464.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'LHR61-C1', 'X-Amz-Cf-Id': '2s6GACkFGfI4DZHtQNXxTL_VAz3o4mjnXhJzji4RUL9LuORAIsO6AA=='})\nHTTP response body: {\"message\": \"Could not authenticate\", \"took\": 0.0, \"requestId\": \"b67d7a41-5be4-4eb3-b869-945e1330a85e\", \"url\": \"xxxxxx "}\n",

the part of authorization in the code

configuration = opsgenie_sdk.Configuration()
# Configure API key authorization: GenieKey
#configuration.api_key['Authorization'] = 'xxxxx'
configuration.username = 'xxxxx'
configuration.password = 'xxxxx'
configuration.verify_ssl = 'False'
conf = opsgenie_sdk.configuration.Configuration()
api_instance = opsgenie_sdk.AccountApi(opsgenie_sdk.ApiClient(configuration))
api_client = opsgenie_sdk.api_client.ApiClient(configuration=conf)
alert_api = opsgenie_sdk.AlertApi(api_client=api_client) 

could you help me please?
  

1 answer

1 vote
Samir Atlassian Team Dec 14, 2021

Hi @Reham Adel !

 

A 401 response from Opsgenie is an authentication error. Could you verify where you got the apiKey you're using? You will need to use an api Key from an API integration in Opsgenie in order to use the Alert API.

 

Thanks,

Samir

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Opsgenie

Leveraging Atlassian’s Opsgenie and AWS Cloudformation Registry to stay ahead of incidents

In the past, managing IT infrastructure was a hard job. It required a lot of manual effort and it was hard to keep track of all the necessary information (monitoring, scalability etc). Thankfully, as...

2,372 views 0 13
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you