curl --request POST \
--url https://api.bydoctor.com.br/api/public/v1/calendar-blocks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"date": "2023-12-25",
"professional_id": 123,
"end_time": "<string>",
"reason": "<string>",
"start_time": "<string>"
}
'import requests
url = "https://api.bydoctor.com.br/api/public/v1/calendar-blocks"
payload = {
"date": "2023-12-25",
"professional_id": 123,
"end_time": "<string>",
"reason": "<string>",
"start_time": "<string>"
}
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({
date: '2023-12-25',
professional_id: 123,
end_time: '<string>',
reason: '<string>',
start_time: '<string>'
})
};
fetch('https://api.bydoctor.com.br/api/public/v1/calendar-blocks', 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://api.bydoctor.com.br/api/public/v1/calendar-blocks",
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([
'date' => '2023-12-25',
'professional_id' => 123,
'end_time' => '<string>',
'reason' => '<string>',
'start_time' => '<string>'
]),
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://api.bydoctor.com.br/api/public/v1/calendar-blocks"
payload := strings.NewReader("{\n \"date\": \"2023-12-25\",\n \"professional_id\": 123,\n \"end_time\": \"<string>\",\n \"reason\": \"<string>\",\n \"start_time\": \"<string>\"\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://api.bydoctor.com.br/api/public/v1/calendar-blocks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"date\": \"2023-12-25\",\n \"professional_id\": 123,\n \"end_time\": \"<string>\",\n \"reason\": \"<string>\",\n \"start_time\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bydoctor.com.br/api/public/v1/calendar-blocks")
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 \"date\": \"2023-12-25\",\n \"professional_id\": 123,\n \"end_time\": \"<string>\",\n \"reason\": \"<string>\",\n \"start_time\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"active": true,
"created_at": "2023-11-07T05:31:56Z",
"date": "2023-12-25",
"end_time": "<string>",
"id": 123,
"professional_id": 123,
"reason": "<string>",
"start_time": "<string>",
"type": "full_day",
"updated_at": "2023-11-07T05:31:56Z"
}Criar um bloqueio de agenda
Cria um bloqueio de agenda de um profissional: o dia inteiro (full_day) ou um intervalo (time_range, com start_time e end_time). O bloqueio pode cair sobre agendamentos já existentes, que ficam como estão: liste os agendamentos do dia com GET /appointments antes de bloquear. Bloqueios recorrentes não existem na API: crie um por dia, em loop. Nada é apagado: para remover um bloqueio use POST /calendar-blocks/{id}/deactivate, e só o aplicativo o reativa. Requer o escopo calendar_blocks:write. Envie Idempotency-Key para poder repetir a chamada com segurança.
curl --request POST \
--url https://api.bydoctor.com.br/api/public/v1/calendar-blocks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"date": "2023-12-25",
"professional_id": 123,
"end_time": "<string>",
"reason": "<string>",
"start_time": "<string>"
}
'import requests
url = "https://api.bydoctor.com.br/api/public/v1/calendar-blocks"
payload = {
"date": "2023-12-25",
"professional_id": 123,
"end_time": "<string>",
"reason": "<string>",
"start_time": "<string>"
}
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({
date: '2023-12-25',
professional_id: 123,
end_time: '<string>',
reason: '<string>',
start_time: '<string>'
})
};
fetch('https://api.bydoctor.com.br/api/public/v1/calendar-blocks', 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://api.bydoctor.com.br/api/public/v1/calendar-blocks",
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([
'date' => '2023-12-25',
'professional_id' => 123,
'end_time' => '<string>',
'reason' => '<string>',
'start_time' => '<string>'
]),
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://api.bydoctor.com.br/api/public/v1/calendar-blocks"
payload := strings.NewReader("{\n \"date\": \"2023-12-25\",\n \"professional_id\": 123,\n \"end_time\": \"<string>\",\n \"reason\": \"<string>\",\n \"start_time\": \"<string>\"\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://api.bydoctor.com.br/api/public/v1/calendar-blocks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"date\": \"2023-12-25\",\n \"professional_id\": 123,\n \"end_time\": \"<string>\",\n \"reason\": \"<string>\",\n \"start_time\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bydoctor.com.br/api/public/v1/calendar-blocks")
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 \"date\": \"2023-12-25\",\n \"professional_id\": 123,\n \"end_time\": \"<string>\",\n \"reason\": \"<string>\",\n \"start_time\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"active": true,
"created_at": "2023-11-07T05:31:56Z",
"date": "2023-12-25",
"end_time": "<string>",
"id": 123,
"professional_id": 123,
"reason": "<string>",
"start_time": "<string>",
"type": "full_day",
"updated_at": "2023-11-07T05:31:56Z"
}Headers
Chave opcional (até 255 caracteres) que torna a criação idempotente: repetir a mesma requisição com a mesma chave em até 24 horas devolve o registro já criado, com o cabeçalho Idempotent-Replayed: true, em vez de criar outro. A mesma chave com um corpo diferente, ou em outro endpoint, responde 422.
Body
Corpo para criar um bloqueio de agenda. Para time_range, envie start_time e end_time.
Response
Bloqueio de agenda: um dia inteiro ou um intervalo em que o profissional não atende.