CreateApiKey

Create API Key.

rpc CreateApiKey

user_api.v1.CreateApiKey

Create API Key.

requests CreateApiKeyRequest

user_api.v1.CreateApiKeyRequest

FieldTypeDescription
client_namestringClient 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

user_api.v1.CreateApiKeyResponse

FieldTypeDescription
api_key_entityApiKeyEntityAPI 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
    }
  }
}