createApiKey
Creates a new api key in the specified project.
/api/v2/projects/{projectId}/api-keys
Usage and SDK Samples
curl -X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
"http://localhost/api/v2/projects/{projectId}/api-keys" \
-d '{
"api_key" : "api_key",
"name" : "name"
}'
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.APIKeyOperationsApi;
import java.io.File;
import java.util.*;
public class APIKeyOperationsApiExample {
public static void main(String[] args) {
// Create an instance of the API class
APIKeyOperationsApi apiInstance = new APIKeyOperationsApi();
String projectId = projectId_example; // String |
ApiKeySyncDto apiKeySyncDto = ; // ApiKeySyncDto |
try {
ApiKeyDto result = apiInstance.createApiKey(projectId, apiKeySyncDto);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling APIKeyOperationsApi#createApiKey");
e.printStackTrace();
}
}
}
import 'package:openapi/api.dart';
final api_instance = DefaultApi();
final String projectId = new String(); // String |
final ApiKeySyncDto apiKeySyncDto = new ApiKeySyncDto(); // ApiKeySyncDto |
try {
final result = await api_instance.createApiKey(projectId, apiKeySyncDto);
print(result);
} catch (e) {
print('Exception when calling DefaultApi->createApiKey: $e\n');
}
import org.openapitools.client.api.APIKeyOperationsApi;
public class APIKeyOperationsApiExample {
public static void main(String[] args) {
APIKeyOperationsApi apiInstance = new APIKeyOperationsApi();
String projectId = projectId_example; // String |
ApiKeySyncDto apiKeySyncDto = ; // ApiKeySyncDto |
try {
ApiKeyDto result = apiInstance.createApiKey(projectId, apiKeySyncDto);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling APIKeyOperationsApi#createApiKey");
e.printStackTrace();
}
}
}
// Create an instance of the API class
APIKeyOperationsApi *apiInstance = [[APIKeyOperationsApi alloc] init];
String *projectId = projectId_example; // (default to null)
ApiKeySyncDto *apiKeySyncDto = ; //
// Creates a new api key in the specified project.
[apiInstance createApiKeyWith:projectId
apiKeySyncDto:apiKeySyncDto
completionHandler: ^(ApiKeyDto output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var OpenApiDefinition = require('open_api_definition');
// Create an instance of the API class
var api = new OpenApiDefinition.APIKeyOperationsApi()
var projectId = projectId_example; // {String}
var apiKeySyncDto = ; // {ApiKeySyncDto}
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.createApiKey(projectId, apiKeySyncDto, callback);
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class createApiKeyExample
{
public void main()
{
// Create an instance of the API class
var apiInstance = new APIKeyOperationsApi();
var projectId = projectId_example; // String | (default to null)
var apiKeySyncDto = new ApiKeySyncDto(); // ApiKeySyncDto |
try {
// Creates a new api key in the specified project.
ApiKeyDto result = apiInstance.createApiKey(projectId, apiKeySyncDto);
Debug.WriteLine(result);
} catch (Exception e) {
Debug.Print("Exception when calling APIKeyOperationsApi.createApiKey: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\APIKeyOperationsApi();
$projectId = projectId_example; // String |
$apiKeySyncDto = ; // ApiKeySyncDto |
try {
$result = $api_instance->createApiKey($projectId, $apiKeySyncDto);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling APIKeyOperationsApi->createApiKey: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::APIKeyOperationsApi;
# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::APIKeyOperationsApi->new();
my $projectId = projectId_example; # String |
my $apiKeySyncDto = WWW::OPenAPIClient::Object::ApiKeySyncDto->new(); # ApiKeySyncDto |
eval {
my $result = $api_instance->createApiKey(projectId => $projectId, apiKeySyncDto => $apiKeySyncDto);
print Dumper($result);
};
if ($@) {
warn "Exception when calling APIKeyOperationsApi->createApiKey: $@\n";
}
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = openapi_client.APIKeyOperationsApi()
projectId = projectId_example # String | (default to null)
apiKeySyncDto = # ApiKeySyncDto |
try:
# Creates a new api key in the specified project.
api_response = api_instance.create_api_key(projectId, apiKeySyncDto)
pprint(api_response)
except ApiException as e:
print("Exception when calling APIKeyOperationsApi->createApiKey: %s\n" % e)
extern crate APIKeyOperationsApi;
pub fn main() {
let projectId = projectId_example; // String
let apiKeySyncDto = ; // ApiKeySyncDto
let mut context = APIKeyOperationsApi::Context::default();
let result = client.createApiKey(projectId, apiKeySyncDto, &context).wait();
println!("{:?}", result);
}
Scopes
Parameters
| Name | Description |
|---|---|
| projectId* |
String
Required
|
| Name | Description |
|---|---|
| apiKeySyncDto * |