Pular para o conteúdo principal
PUT
/
v1
/
organizations
/
{organization_id}
/
ledgers
/
{ledger_id}
/
asset-rates
Criar ou Atualizar uma Taxa de Ativo
curl --request PUT \
  --url https://ledger.sandbox.lerian.net/v1/organizations/{organization_id}/ledgers/{ledger_id}/asset-rates \
  --header 'Content-Type: application/json' \
  --data '
{
  "createdAt": "2023-11-07T05:31:56Z",
  "externalId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "from": "<string>",
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "ledgerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "metadata": {},
  "organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "rate": 123,
  "scale": 1,
  "source": "<string>",
  "to": "<string>",
  "ttl": 1,
  "updatedAt": "2023-11-07T05:31:56Z"
}
'
import requests

url = "https://ledger.sandbox.lerian.net/v1/organizations/{organization_id}/ledgers/{ledger_id}/asset-rates"

payload = {
"createdAt": "2023-11-07T05:31:56Z",
"externalId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"from": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"ledgerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"metadata": {},
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rate": 123,
"scale": 1,
"source": "<string>",
"to": "<string>",
"ttl": 1,
"updatedAt": "2023-11-07T05:31:56Z"
}
headers = {"Content-Type": "application/json"}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
createdAt: '2023-11-07T05:31:56Z',
externalId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
from: '<string>',
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
ledgerId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
metadata: {},
organizationId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
rate: 123,
scale: 1,
source: '<string>',
to: '<string>',
ttl: 1,
updatedAt: '2023-11-07T05:31:56Z'
})
};

fetch('https://ledger.sandbox.lerian.net/v1/organizations/{organization_id}/ledgers/{ledger_id}/asset-rates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://ledger.sandbox.lerian.net/v1/organizations/{organization_id}/ledgers/{ledger_id}/asset-rates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'createdAt' => '2023-11-07T05:31:56Z',
'externalId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'from' => '<string>',
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'ledgerId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'metadata' => [

],
'organizationId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'rate' => 123,
'scale' => 1,
'source' => '<string>',
'to' => '<string>',
'ttl' => 1,
'updatedAt' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

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

func main() {

url := "https://ledger.sandbox.lerian.net/v1/organizations/{organization_id}/ledgers/{ledger_id}/asset-rates"

payload := strings.NewReader("{\n \"createdAt\": \"2023-11-07T05:31:56Z\",\n \"externalId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"from\": \"<string>\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"ledgerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"metadata\": {},\n \"organizationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"rate\": 123,\n \"scale\": 1,\n \"source\": \"<string>\",\n \"to\": \"<string>\",\n \"ttl\": 1,\n \"updatedAt\": \"2023-11-07T05:31:56Z\"\n}")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://ledger.sandbox.lerian.net/v1/organizations/{organization_id}/ledgers/{ledger_id}/asset-rates")
.header("Content-Type", "application/json")
.body("{\n \"createdAt\": \"2023-11-07T05:31:56Z\",\n \"externalId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"from\": \"<string>\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"ledgerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"metadata\": {},\n \"organizationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"rate\": 123,\n \"scale\": 1,\n \"source\": \"<string>\",\n \"to\": \"<string>\",\n \"ttl\": 1,\n \"updatedAt\": \"2023-11-07T05:31:56Z\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://ledger.sandbox.lerian.net/v1/organizations/{organization_id}/ledgers/{ledger_id}/asset-rates")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"createdAt\": \"2023-11-07T05:31:56Z\",\n \"externalId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"from\": \"<string>\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"ledgerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"metadata\": {},\n \"organizationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"rate\": 123,\n \"scale\": 1,\n \"source\": \"<string>\",\n \"to\": \"<string>\",\n \"ttl\": 1,\n \"updatedAt\": \"2023-11-07T05:31:56Z\"\n}"

response = http.request(request)
puts response.read_body
{
  "createdAt": "2023-11-07T05:31:56Z",
  "externalId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "from": "<string>",
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "ledgerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "metadata": {},
  "organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "rate": 123,
  "scale": 1,
  "source": "<string>",
  "to": "<string>",
  "ttl": 1,
  "updatedAt": "2023-11-07T05:31:56Z"
}
{
"code": "<string>",
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}

Cabeçalhos

Content-Type
string

O tipo de mídia do recurso. O valor recomendado é application/json.

X-Request-Id
string<uuid>

Um identificador único utilizado para rastrear e acompanhar cada requisição.

Authorization
string

Token JWT bearer para autenticação. Obrigatório quando PLUGIN_AUTH_ENABLED=true (exigido em implantações multi-tenant). Opcional no modo OSS single-tenant padrão. Formato: Bearer <token>

Parâmetros de caminho

organization_id
string<uuid>
obrigatório

O identificador único da Organização associada ao Ledger.

ledger_id
string<uuid>
obrigatório

O identificador único do Ledger associado.

Corpo

application/json
createdAt
string<date-time>
obrigatório
Exemplo:

"2021-01-01T00:00:00Z"

externalId
string<uuid>
obrigatório
Exemplo:

"00000000-0000-0000-0000-000000000000"

from
string
obrigatório
Required string length: 2 - 10
Exemplo:

"USD"

id
string<uuid>
obrigatório
Exemplo:

"00000000-0000-0000-0000-000000000000"

ledgerId
string<uuid>
obrigatório
Exemplo:

"00000000-0000-0000-0000-000000000000"

metadata
object
obrigatório
organizationId
string<uuid>
obrigatório
Exemplo:

"00000000-0000-0000-0000-000000000000"

rate
number<double>
obrigatório
Exemplo:

100

scale
number<double> | null
obrigatório
Intervalo obrigatório: x >= 0
Exemplo:

2

source
string | null
obrigatório
Maximum string length: 200
Exemplo:

"External System"

to
string
obrigatório
Required string length: 2 - 10
Exemplo:

"BRL"

ttl
integer<int64>
obrigatório
Intervalo obrigatório: x >= 0
Exemplo:

3600

updatedAt
string<date-time>
obrigatório
Exemplo:

"2021-01-01T00:00:00Z"

Resposta

OK

createdAt
string<date-time>
obrigatório
Exemplo:

"2021-01-01T00:00:00Z"

externalId
string<uuid>
obrigatório
Exemplo:

"00000000-0000-0000-0000-000000000000"

from
string
obrigatório
Required string length: 2 - 10
Exemplo:

"USD"

id
string<uuid>
obrigatório
Exemplo:

"00000000-0000-0000-0000-000000000000"

ledgerId
string<uuid>
obrigatório
Exemplo:

"00000000-0000-0000-0000-000000000000"

metadata
object
obrigatório
organizationId
string<uuid>
obrigatório
Exemplo:

"00000000-0000-0000-0000-000000000000"

rate
number<double>
obrigatório
Exemplo:

100

scale
number<double> | null
obrigatório
Intervalo obrigatório: x >= 0
Exemplo:

2

source
string | null
obrigatório
Maximum string length: 200
Exemplo:

"External System"

to
string
obrigatório
Required string length: 2 - 10
Exemplo:

"BRL"

ttl
integer<int64>
obrigatório
Intervalo obrigatório: x >= 0
Exemplo:

3600

updatedAt
string<date-time>
obrigatório
Exemplo:

"2021-01-01T00:00:00Z"