Generates an RSA key

Generates a new RSA key.

Endpoint: /api/key/generate

API_TOKEN="Place here your API Token"

curl -X POST "https://service.dinamonetworks.io/api/key/generate" -H "accept: application/json; charset=utf-8" -H "X-Api-Key: ${API_TOKEN}" -d '{"label":"name your key", "type":"rsa2048"}'
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"type\": \"rsa2048\",\r\n    \"label\": \"key\"\r\n}");
Request request = new Request.Builder()
  .url("https://service.dinamonetworks.io/api/key/generate")
  .method("POST", body)
  .addHeader("X-Api-Key", "Place here your API Token")
  .addHeader("Content-Type", "application/json")
  .build();
Response response = client.newCall(request).execute();
var client = new RestClient("https://service.dinamonetworks.io/api/key/generate");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("X-Api-Key", "Place here your API Token");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@"    ""type"": ""rsa2048"",
" + "\n" +
@"    ""label"": ""key""
" + "\n" +
@"}";
request.AddParameter("application/json", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://service.dinamonetworks.io/api/key/generate"
  method := "POST"
  api_token := "Place here your API Token"

  payload := strings.NewReader(`{`+"
"+`
    "type": "rsa2048",`+"
"+`
    "label": "key"`+"
"+`
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("X-Api-Key", api_token)
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
var settings = {
  "url": "https://service.dinamonetworks.io/api/key/generate",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "X-Api-Key": "Place here your API Token",
    "Content-Type": "application/json"
  },
  "data": JSON.stringify({
    "type": "rsa2048",
    "label": "key"
  }),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});

Response

{
  "message": "Key created successfully!!!",
  "id": "5W1BJe3jizpSVodT"
}