Skip to main content
POST
/
api
/
v1
/
admin
/
migration
/
start
Inicia uma migração de schema
curl --request POST \
  --url https://services.pref.rio/app-busca-search/api/v1/admin/migration/start \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "schema_version": "<string>",
  "async": true,
  "dry_run": true
}
'
import requests

url = "https://services.pref.rio/app-busca-search/api/v1/admin/migration/start"

payload = {
"schema_version": "<string>",
"async": True,
"dry_run": True
}
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({schema_version: '<string>', async: true, dry_run: true})
};

fetch('https://services.pref.rio/app-busca-search/api/v1/admin/migration/start', 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://services.pref.rio/app-busca-search/api/v1/admin/migration/start",
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([
'schema_version' => '<string>',
'async' => true,
'dry_run' => true
]),
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 := "https://services.pref.rio/app-busca-search/api/v1/admin/migration/start"

payload := strings.NewReader("{\n \"schema_version\": \"<string>\",\n \"async\": true,\n \"dry_run\": true\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("https://services.pref.rio/app-busca-search/api/v1/admin/migration/start")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"schema_version\": \"<string>\",\n \"async\": true,\n \"dry_run\": true\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://services.pref.rio/app-busca-search/api/v1/admin/migration/start")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"schema_version\": \"<string>\",\n \"async\": true,\n \"dry_run\": true\n}"

response = http.request(request)
puts response.read_body
{
  "backup_collection": "<string>",
  "completed_at": 123,
  "error_message": "<string>",
  "is_locked": true,
  "migrated_documents": 123,
  "progress": 123,
  "schema_version": "<string>",
  "source_collection": "<string>",
  "started_at": 123,
  "started_by": "<string>",
  "target_collection": "<string>",
  "total_documents": 123
}
{}
{}
{}
{}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Dados da migração

schema_version
string
required
async
boolean

Se true, executa em background (para API)

dry_run
boolean

Response

OK

backup_collection
string
completed_at
integer
error_message
string
is_locked
boolean
migrated_documents
integer
progress
number
schema_version
string
source_collection
string
started_at
integer
started_by
string
status
enum<string>
Available options:
idle,
in_progress,
completed,
failed,
rollback
target_collection
string
total_documents
integer