3

Hi I am trying to disable an API key programmatically, but can't find any documentation.

So far I have located 2 classes that might be what I need:

UpdateApiKeyRequest and DeleteApiKeyRequest. Problem is that I have no clue what to do with these.

Please could someone show me how to use these classes to disable or delete an API key?

1 Answers1

7

You can use deleteApiKey API.

The SDK source code is available here. The documentation is available here.

Update:

You can disable an API Key using updateApiKey API.

The SDK is documented here. The API reference is here.

The below is a sample PatchOperations object to be sent in the PATCH request:

{"patchOperations":[{"op":"replace","path":"/enabled","value":"false"}]}
Community
  • 1
  • 1
Balaji
  • 1,028
  • 8
  • 12
  • Thanks, that should do the trick. Do you know how I would go about disabling a key instead of deleting a key? I see there is an UpdateApiKeyRequest too, but I don't know what values to populate on it's PatchOperations member. – Duran Wesley Harris Apr 01 '16 at 05:41
  • @DuranWesleyHarris: Updated the answer with the details for disabling the API Key. – Balaji Apr 01 '16 at 19:26
  • Thank you very much this is exactly what I need – Duran Wesley Harris Apr 04 '16 at 05:51
  • Ok I populated the PatchOperations object as you indicated but I get this error: com.amazonaws.services.apigateway.model.NotFoundException: Invalid Metering Id identifier specified (Service: AmazonApiGateway; Status Code: 404; Error Code: NotFoundException; Request ID: 19c55e0e-fa2f-11e5-8958-7711b14a79a6) – Duran Wesley Harris Apr 04 '16 at 06:38