curl --request POST \
--url http://localhost:8090/internal/v1/connections/{connection_id}/snapshots/{run_id}/pages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"observations": [
{
"external_id": "<string>",
"operation": "upsert",
"revision": 2,
"source_updated_at": "2023-11-07T05:31:56Z",
"document": {},
"raw": "<unknown>"
}
]
}
'import requests
url = "http://localhost:8090/internal/v1/connections/{connection_id}/snapshots/{run_id}/pages"
payload = { "observations": [
{
"external_id": "<string>",
"operation": "upsert",
"revision": 2,
"source_updated_at": "2023-11-07T05:31:56Z",
"document": {},
"raw": "<unknown>"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
observations: [
{
external_id: '<string>',
operation: 'upsert',
revision: 2,
source_updated_at: '2023-11-07T05:31:56Z',
document: {},
raw: '<unknown>'
}
]
})
};
fetch('http://localhost:8090/internal/v1/connections/{connection_id}/snapshots/{run_id}/pages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8090",
CURLOPT_URL => "http://localhost:8090/internal/v1/connections/{connection_id}/snapshots/{run_id}/pages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'observations' => [
[
'external_id' => '<string>',
'operation' => 'upsert',
'revision' => 2,
'source_updated_at' => '2023-11-07T05:31:56Z',
'document' => [
],
'raw' => '<unknown>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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 := "http://localhost:8090/internal/v1/connections/{connection_id}/snapshots/{run_id}/pages"
payload := strings.NewReader("{\n \"observations\": [\n {\n \"external_id\": \"<string>\",\n \"operation\": \"upsert\",\n \"revision\": 2,\n \"source_updated_at\": \"2023-11-07T05:31:56Z\",\n \"document\": {},\n \"raw\": \"<unknown>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.post("http://localhost:8090/internal/v1/connections/{connection_id}/snapshots/{run_id}/pages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"observations\": [\n {\n \"external_id\": \"<string>\",\n \"operation\": \"upsert\",\n \"revision\": 2,\n \"source_updated_at\": \"2023-11-07T05:31:56Z\",\n \"document\": {},\n \"raw\": \"<unknown>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8090/internal/v1/connections/{connection_id}/snapshots/{run_id}/pages")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"observations\": [\n {\n \"external_id\": \"<string>\",\n \"operation\": \"upsert\",\n \"revision\": 2,\n \"source_updated_at\": \"2023-11-07T05:31:56Z\",\n \"document\": {},\n \"raw\": \"<unknown>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"index": 1,
"status": "accepted",
"observation_id": "<string>",
"reason": "<string>"
}
]
}{
"code": "<string>",
"detail": "<string>"
}Entregar un lote del snapshot
Mismo formato de respuesta que las observaciones sueltas, y la misma regla: una entidad que no valida se pone en cuarentena y las demás del lote entran. Sólo upsert — lo que falta al cerrar es lo que se borra.
curl --request POST \
--url http://localhost:8090/internal/v1/connections/{connection_id}/snapshots/{run_id}/pages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"observations": [
{
"external_id": "<string>",
"operation": "upsert",
"revision": 2,
"source_updated_at": "2023-11-07T05:31:56Z",
"document": {},
"raw": "<unknown>"
}
]
}
'import requests
url = "http://localhost:8090/internal/v1/connections/{connection_id}/snapshots/{run_id}/pages"
payload = { "observations": [
{
"external_id": "<string>",
"operation": "upsert",
"revision": 2,
"source_updated_at": "2023-11-07T05:31:56Z",
"document": {},
"raw": "<unknown>"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
observations: [
{
external_id: '<string>',
operation: 'upsert',
revision: 2,
source_updated_at: '2023-11-07T05:31:56Z',
document: {},
raw: '<unknown>'
}
]
})
};
fetch('http://localhost:8090/internal/v1/connections/{connection_id}/snapshots/{run_id}/pages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8090",
CURLOPT_URL => "http://localhost:8090/internal/v1/connections/{connection_id}/snapshots/{run_id}/pages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'observations' => [
[
'external_id' => '<string>',
'operation' => 'upsert',
'revision' => 2,
'source_updated_at' => '2023-11-07T05:31:56Z',
'document' => [
],
'raw' => '<unknown>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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 := "http://localhost:8090/internal/v1/connections/{connection_id}/snapshots/{run_id}/pages"
payload := strings.NewReader("{\n \"observations\": [\n {\n \"external_id\": \"<string>\",\n \"operation\": \"upsert\",\n \"revision\": 2,\n \"source_updated_at\": \"2023-11-07T05:31:56Z\",\n \"document\": {},\n \"raw\": \"<unknown>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.post("http://localhost:8090/internal/v1/connections/{connection_id}/snapshots/{run_id}/pages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"observations\": [\n {\n \"external_id\": \"<string>\",\n \"operation\": \"upsert\",\n \"revision\": 2,\n \"source_updated_at\": \"2023-11-07T05:31:56Z\",\n \"document\": {},\n \"raw\": \"<unknown>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8090/internal/v1/connections/{connection_id}/snapshots/{run_id}/pages")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"observations\": [\n {\n \"external_id\": \"<string>\",\n \"operation\": \"upsert\",\n \"revision\": 2,\n \"source_updated_at\": \"2023-11-07T05:31:56Z\",\n \"document\": {},\n \"raw\": \"<unknown>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"index": 1,
"status": "accepted",
"observation_id": "<string>",
"reason": "<string>"
}
]
}{
"code": "<string>",
"detail": "<string>"
}Autorizaciones
Un conector custom (ADR 0013 §4). El token nace del alta de la conexión (POST /internal/v1/custom-connections), vale para una conexión y sólo escribe en ella: presentado contra otra conexión es 401.
Parámetros de ruta
La conexión de CrossUp.
1El run de snapshot abierto para esta conexión y esta entidad.
^snp_.+Cuerpo
Un lote del snapshot. Sólo upsert: lo que falta al cerrar es lo que se da de baja, así que un delete explícito acá no querría decir nada.
1 - 500 elementsShow child attributes
Show child attributes
Respuesta
Un resultado por posición.
Un resultado por posición. El lote entero nunca falla por una entidad.
1Show child attributes
Show child attributes