Create API Key.
rpc CreateApiKey
CreateApiKey
user_api.v1.CreateApiKey
user_api.v1.CreateApiKey
Create API Key.
requests CreateApiKeyRequest
CreateApiKeyRequest
user_api.v1.CreateApiKeyRequest
user_api.v1.CreateApiKeyRequest
Field | Type | Description |
---|---|---|
client_name | string | Client Name. |
resp, _ := apiKeyManagerService.CreateApiKey(ctx, &v1.CreateApiKeyRequest{
ClientName: "CLIENT_NAME",
})
fmt.Println(resp)
const createapikeyrequest = new CreateApiKeyRequest();
createapikeyrequest.setClientName("CLIENT_NAME");
service.createApiKey(createapikeyrequest, (err, value:CreateApiKeyResponse|null) => {
const resp = JSON.stringify(err ? err : value);
console.log("received ", resp);
})
using System;
using Grpc.Core;
using UserApi.V1;
namespace main
{
class Program
{
static void Main(string[] args)
{
Channel channel = new Channel("user-mgmt.YOUR_SANDBOX_ID.knoxnetworks.io:443", ChannelCredentials.Insecure);
var client = new ApiKeyManagerService.ApiKeyManagerServiceClient(channel);
var headers = new Metadata();
var createApiKeyRequest = new CreateApiKeyRequest{
ClientName = "CLIENT_NAME",
};
var reply = client.CreateApiKey(createApiKeyRequest, headers);
Console.WriteLine("Response: " + reply);
channel.ShutdownAsync().Wait();
}
}
}
package demo;
import io.grpc.Channel;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import user_api.v1.ApiKeyManagerServiceGrpc;
import user_api.v1.User.CreateApiKeyRequest;
import user_api.v1.User.CreateApiKeyResponse;
public class App {
public static void main(String[] args) {
ManagedChannel channel = ManagedChannelBuilder
.forAddress("user-mgmt.YOUR_SANDBOX_ID.knoxnetworks.io", 443)
.usePlaintext()
.build();
ApiKeyManagerServiceGrpc.ApiKeyManagerServiceBlockingStub blockStub =
ApiKeyManagerServiceGrpc.newBlockingStub(channel);
CreateApiKeyRequest req_CreateApiKeyRequest =
CreateApiKeyRequest.newBuilder()
.setClientName("CLIENT_NAME")
.build();
CreateApiKeyResponse resp = blockStub.createApiKey(req_CreateApiKeyRequest);
System.out.println(resp);
channel.shutdown();
}
}
const createapikeyrequest = new CreateApiKeyRequest();
createapikeyrequest.setClientName("CLIENT_NAME");
service.createApiKey(createapikeyrequest, (err, value) => {
const resp = JSON.stringify(err ? err : value);
console.log("received ", resp);
})
extern crate grpc-sdks;
use tonic::transport::Channel;
use grpc-sdks::user_api::v1::api_key_manager_service_client::ApiKeyManagerServiceClient;
use grpc-sdks::user_api::v1::CreateApiKeyRequest;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let channel = Channel::from_static("user-mgmt.YOUR_SANDBOX_ID.knoxnetworks.io")
.connect()
.await?;
let mut client = ApiKeyManagerServiceClient::new(channel);
let request = tonic::Request::new(
CreateApiKeyRequest{
client_name: String::from("CLIENT_NAME")
});
// sending request and waiting for response
let response = client.create_api_key(request).await?.into_inner();
println!("RESPONSE={:?}", response);
Ok(())
}
package app
import io.grpc.ManagedChannelBuilder
import user_api.v1.ApiKeyManagerServiceGrpc
import user_api.v1.User.CreateApiKeyRequest
import user_api.v1.User.CreateApiKeyResponse
fun main() {
val channel = ManagedChannelBuilder
.forAddress("user-mgmt.YOUR_SANDBOX_ID.knoxnetworks.io", 443)
.usePlaintext()
.build()
var blockStub = ApiKeyManagerServiceGrpc.newBlockingStub(channel)
val req_CreateApiKeyRequest = CreateApiKeyRequest.newBuilder()
.setClientName("CLIENT_NAME")
.build()
val resp = blockStub.createApiKey(req_CreateApiKeyRequest)
println(resp)
channel.shutdown()
}
returns CreateApiKeyResponse
CreateApiKeyResponse
user_api.v1.CreateApiKeyResponse
user_api.v1.CreateApiKeyResponse
Field | Type | Description |
---|---|---|
api_key_entity | ApiKeyEntity | API Key Entity. |
{
"api_key_entity": {
"client_id": "CLIENT_ID",
"client_name": "CLIENT_NAME",
"api_key": "API_KEY",
"status": 0,
"expiry_date": {
"seconds": 0,
"nanos": 0
}
}
}