[NEVER MIND] Java SDK: "Key format is not valid"

Sam Peretz November 10, 2021

I was getting an invalid value for the key. My bad! Please ignore this!

 

I'm trying to create an alert using the Java SDK.  I've followed the guide for setting the API key, trying all sorts of permutations:

OpsGenieClient client = new OpsGenieClient();

...

client.setApiKey(myKey);

or

client.setApiKey(base64Encode(myKey));

or

client.setApiKey(base64UrlEncode(myKey));

or using

alertApi = client.alertV2();

...

alertApi.getApiClient().setApiKey(myKey);

or the same variations as above passing the base 64 encoded or base 64 URL encoded key to alertApi.getApiClient().setApiKey(...);

 

No matter what I try, I always get the same result:

com.ifountain.opsgenie.client.swagger.ApiException: 
{
"message": "Key format is not valid!",
"took": 0.001,
"requestId": "7ef9d057-8b49-4264-ad70-e79a14a3e1cb"
}

 What am I doing wrong??

1 answer

0 votes
Samir
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 11, 2021

Hi @Sam Peretz ,

 

Are you still having issues with this? This section details the 2 different ways you can set-up the apiKey. You will want to get an api Key from an API integration in Opsgenie.

 

Let us know if you're still running into issues!

 

Thanks,

Samir

Sam Peretz November 11, 2021

Thanks @Samir, I'm all set. As mentioned in my update to the question (at the topic), I was just doing something dumb -- I was getting the API key from AWS SSM Parameter Store and wasn't setting the decryption option correctly, so I was using the encrypted value I was getting back from that call, which of course was not a valid API key! :O  It's working great now.

Like Steffen Opel _Utoolity_ likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events