Cria um novo mecanismo

Gera um novo mecanismo para o cofre (SVault). A Engine funciona como um agrupamento de configuração. A engine possui a configuração do tipo de formato do dado, se há algum tipo de armazenamento interno ou externo e se o dado possui algum tipo de checksum para geração do seu substituto.

Endpoint: api/svault/engine

API_TOKEN="Place here your API Token"

curl --location --request POST 'https://service.dinamonetworks.io/api/svault/engine' \
--header 'Content-Type: application/json' \
--header "X-Api-Key: ${API_TOKEN}" \
--data-raw '{
  "label": "myengine",
  "storage": "internal",
  "format": "base10",
  "checksum": "nocheck"
}'
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"label\": \"myengine\",\n  \"storage\": \"internal\",\n  \"format\": \"base10\",\n  \"checksum\": \"nocheck\"\n}");
Request request = new Request.Builder()
  .url("https://service.dinamonetworks.io/api/svault/engine")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-Api-Key", "Place here your API Token")
  .build();
Response response = client.newCall(request).execute();
var client = new RestClient("https://service.dinamonetworks.io/api/svault/engine");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("X-Api-Key", "Place here your API Token");
var body = @"{" + "\n" +
@"  ""label"": ""myengine""," + "\n" +
@"  ""storage"": ""internal""," + "\n" +
@"  ""format"": ""base10""," + "\n" +
@"  ""checksum"": ""nocheck""" + "\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/svault/engine"
  method := "POST"

  payload := strings.NewReader(`{
  "label": "myengine",
  "storage": "internal",
  "format": "base10",
  "checksum": "nocheck"
}`)

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

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

  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/svault/engine",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": "Place here your API Token"
  },
  "data": JSON.stringify({
    "label": "myengine",
    "storage": "internal",
    "format": "base10",
    "checksum": "nocheck"
  }),
};

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

Response

{
    "message": "Engine created successfully!!!",
    "id": "2OWPQCQAAELU9NsN"
}