API key Management APIs

GenerateApiKey

Creates an Api Key under a given tenant for the provisioning service.


/IDPrimeVirtual/ApiManager/V1.0/Tenants/{tenantId}/ApiKey/{keyName}

Usage and SDK Samples

curl -X POST\
-H "Authorization: [[apiKey]]"\
-H "Accept: application/json"\
"//IDPrimeVirtual/ApiManager/V1.0/Tenants/{tenantId}/ApiKey/{keyName}"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.ApiKeyApi;

import java.io.File;
import java.util.*;

public class ApiKeyApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure API key authorization: Bearer
        ApiKeyAuth Bearer = (ApiKeyAuth) defaultClient.getAuthentication("Bearer");
        Bearer.setApiKey("YOUR API KEY");
        // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
        //Bearer.setApiKeyPrefix("Token");

        ApiKeyApi apiInstance = new ApiKeyApi();
        String tenantId = tenantId_example; // String | Tenant Identifier (GUID format).
        String keyName = keyName_example; // String | Friendly name or Alias assigned to the api key.
        try {
            ApiKey result = apiInstance.iDPrimeVirtualApiManagerV10TenantsTenantIdApiKeyKeyNamePost(tenantId, keyName);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling ApiKeyApi#iDPrimeVirtualApiManagerV10TenantsTenantIdApiKeyKeyNamePost");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.ApiKeyApi;

public class ApiKeyApiExample {

    public static void main(String[] args) {
        ApiKeyApi apiInstance = new ApiKeyApi();
        String tenantId = tenantId_example; // String | Tenant Identifier (GUID format).
        String keyName = keyName_example; // String | Friendly name or Alias assigned to the api key.
        try {
            ApiKey result = apiInstance.iDPrimeVirtualApiManagerV10TenantsTenantIdApiKeyKeyNamePost(tenantId, keyName);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling ApiKeyApi#iDPrimeVirtualApiManagerV10TenantsTenantIdApiKeyKeyNamePost");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure API key authorization: (authentication scheme: Bearer)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"Authorization"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"Authorization"];
String *tenantId = tenantId_example; // Tenant Identifier (GUID format).
String *keyName = keyName_example; // Friendly name or Alias assigned to the api key.

ApiKeyApi *apiInstance = [[ApiKeyApi alloc] init];

// Creates an Api Key under a given tenant for the provisioning service.
[apiInstance iDPrimeVirtualApiManagerV1TenantsTenantIdApiKeyKeyNamePostWith:tenantId
    keyName:keyName
              completionHandler: ^(ApiKey output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var ApiKeyManagementApIs = require('api_key_management_ap_is');
var defaultClient = ApiKeyManagementApIs.ApiClient.instance;

// Configure API key authorization: Bearer Token
var Bearer = defaultClient.authentications['Bearer'];
Bearer.apiKey = "YOUR Bearer Token"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Bearer.apiKeyPrefix['Authorization'] = "Token"

var api = new ApiKeyManagementApIs.ApiKeyApi()
var tenantId = tenantId_example; // {{String}} Tenant Identifier (GUID format).
var keyName = keyName_example; // {{String}} Friendly name or Alias assigned to the api key.

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.iDPrimeVirtualApiManagerV10TenantsTenantIdApiKeyKeyNamePost(tenantId, keyName, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class iDPrimeVirtualApiManagerV1TenantsTenantIdApiKeyKeyNamePostExample
    {
        public void main()
        {

            // Configure API key authorization: Bearer
            Configuration.Default.ApiKey.Add("Authorization", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.ApiKeyPrefix.Add("Authorization", "Bearer");

            var apiInstance = new ApiKeyApi();
            var tenantId = tenantId_example;  // String | Tenant Identifier (GUID format).
            var keyName = keyName_example;  // String | Friendly name or Alias assigned to the api key.

            try
            {
                // Creates an Api Key under a given tenant for the provisioning service.
                ApiKey result = apiInstance.iDPrimeVirtualApiManagerV10TenantsTenantIdApiKeyKeyNamePost(tenantId, keyName);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling ApiKeyApi.iDPrimeVirtualApiManagerV10TenantsTenantIdApiKeyKeyNamePost: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$api_instance = new Swagger\Client\ApiApiKeyApi();
$tenantId = tenantId_example; // String | Tenant Identifier (GUID format).
$keyName = keyName_example; // String | Friendly name or Alias assigned to the api key.

try {
    $result = $api_instance->iDPrimeVirtualApiManagerV10TenantsTenantIdApiKeyKeyNamePost($tenantId, $keyName);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ApiKeyApi->iDPrimeVirtualApiManagerV10TenantsTenantIdApiKeyKeyNamePost: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::ApiKeyApi;

# Configure API key authorization: Bearer
$WWW::SwaggerClient::Configuration::api_key->{'Authorization'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$WWW::SwaggerClient::Configuration::api_key_prefix->{'Authorization'} = "Bearer";

my $api_instance = WWW::SwaggerClient::ApiKeyApi->new();
my $tenantId = tenantId_example; # String | Tenant Identifier (GUID format).
my $keyName = keyName_example; # String | Friendly name or Alias assigned to the api key.

eval { 
    my $result = $api_instance->iDPrimeVirtualApiManagerV10TenantsTenantIdApiKeyKeyNamePost(tenantId => $tenantId, keyName => $keyName);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling ApiKeyApi->iDPrimeVirtualApiManagerV10TenantsTenantIdApiKeyKeyNamePost: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: Bearer
swagger_client.configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# swagger_client.configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.ApiKeyApi()
tenantId = tenantId_example # String | Tenant Identifier (GUID format).
keyName = keyName_example # String | Friendly name or Alias assigned to the api key.

try: 
    # Creates an Api Key under a given tenant for the provisioning service.
    api_response = api_instance.i_d_prime_virtual_api_manager_v1_tenants_tenant_id_api_key_key_name_post(tenantId, keyName)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiKeyApi->iDPrimeVirtualApiManagerV10TenantsTenantIdApiKeyKeyNamePost: %s\n" % e)

Parameters

Path parameters
Name Description
tenantId*
String
Tenant Identifier (GUID format).
Required
keyName*
String
Friendly name or Alias assigned to the api key.
Required

Responses

Status: 200 - Success - Returns Api key which consists of ApiKeyId, Name and ExpirationTime in UTC Date Time.

Status: 400 - Bad Request - Client Side Error!

Status: 401 - Unauthorized Access!

Status: 404 - Tenant Not Found!

Status: 409 - Conflict

Status: 500 - Internal Server Error!