Withdraw a trip's approval request
curl --request POST \
--url https://api.travel.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/trips/{tripId}/request/cancel \
--header 'Content-Type: application/json' \
--data '
{
"policyRequestId": "b7f1c0d2-4e3a-4f8b-9c21-7a6d5e4f3b2a"
}
'import requests
url = "https://api.travel.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/trips/{tripId}/request/cancel"
payload = { "policyRequestId": "b7f1c0d2-4e3a-4f8b-9c21-7a6d5e4f3b2a" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({policyRequestId: 'b7f1c0d2-4e3a-4f8b-9c21-7a6d5e4f3b2a'})
};
fetch('https://api.travel.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/trips/{tripId}/request/cancel', 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.travel.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/trips/{tripId}/request/cancel",
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([
'policyRequestId' => 'b7f1c0d2-4e3a-4f8b-9c21-7a6d5e4f3b2a'
]),
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://api.travel.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/trips/{tripId}/request/cancel"
payload := strings.NewReader("{\n \"policyRequestId\": \"b7f1c0d2-4e3a-4f8b-9c21-7a6d5e4f3b2a\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.travel.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/trips/{tripId}/request/cancel")
.header("Content-Type", "application/json")
.body("{\n \"policyRequestId\": \"b7f1c0d2-4e3a-4f8b-9c21-7a6d5e4f3b2a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.travel.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/trips/{tripId}/request/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"policyRequestId\": \"b7f1c0d2-4e3a-4f8b-9c21-7a6d5e4f3b2a\"\n}"
response = http.request(request)
puts response.read_body{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "TRAVEL_REQUESTER_OR_ADMIN_REQUIRED",
"origin": "TRAVEL",
"message": "Organization admin or the user who requested the approval required"
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "TRIP_NOT_FOUND",
"origin": "TRAVEL",
"message": "Trip not found"
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "TRIP_REQUEST_IN_PROGRESS",
"origin": "TRAVEL",
"message": "The approval request is still being created; try again shortly"
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "BAD_REQUEST",
"origin": "TRAVEL",
"message": "Bad Request: Your request is invalid or incomplete. Please make sure you are requesting with the right fields.",
"fields": [
{
"field": "policyRequestId",
"message": "Invalid UUID",
"code": "POLICYREQUESTID_UUID"
}
]
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "POLICY_EVALUATION_UNAVAILABLE",
"origin": "TRAVEL",
"message": "Business policy evaluation temporarily unavailable, please retry."
}Withdraw a trip's approval request
Withdraws the approval request of a trip.
POST
/
realms
/
{realmId}
/
organizations
/
{organizationId}
/
trips
/
{tripId}
/
request
/
cancel
Withdraw a trip's approval request
curl --request POST \
--url https://api.travel.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/trips/{tripId}/request/cancel \
--header 'Content-Type: application/json' \
--data '
{
"policyRequestId": "b7f1c0d2-4e3a-4f8b-9c21-7a6d5e4f3b2a"
}
'import requests
url = "https://api.travel.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/trips/{tripId}/request/cancel"
payload = { "policyRequestId": "b7f1c0d2-4e3a-4f8b-9c21-7a6d5e4f3b2a" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({policyRequestId: 'b7f1c0d2-4e3a-4f8b-9c21-7a6d5e4f3b2a'})
};
fetch('https://api.travel.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/trips/{tripId}/request/cancel', 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.travel.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/trips/{tripId}/request/cancel",
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([
'policyRequestId' => 'b7f1c0d2-4e3a-4f8b-9c21-7a6d5e4f3b2a'
]),
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://api.travel.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/trips/{tripId}/request/cancel"
payload := strings.NewReader("{\n \"policyRequestId\": \"b7f1c0d2-4e3a-4f8b-9c21-7a6d5e4f3b2a\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.travel.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/trips/{tripId}/request/cancel")
.header("Content-Type", "application/json")
.body("{\n \"policyRequestId\": \"b7f1c0d2-4e3a-4f8b-9c21-7a6d5e4f3b2a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.travel.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/trips/{tripId}/request/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"policyRequestId\": \"b7f1c0d2-4e3a-4f8b-9c21-7a6d5e4f3b2a\"\n}"
response = http.request(request)
puts response.read_body{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "TRAVEL_REQUESTER_OR_ADMIN_REQUIRED",
"origin": "TRAVEL",
"message": "Organization admin or the user who requested the approval required"
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "TRIP_NOT_FOUND",
"origin": "TRAVEL",
"message": "Trip not found"
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "TRIP_REQUEST_IN_PROGRESS",
"origin": "TRAVEL",
"message": "The approval request is still being created; try again shortly"
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "BAD_REQUEST",
"origin": "TRAVEL",
"message": "Bad Request: Your request is invalid or incomplete. Please make sure you are requesting with the right fields.",
"fields": [
{
"field": "policyRequestId",
"message": "Invalid UUID",
"code": "POLICYREQUESTID_UUID"
}
]
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "POLICY_EVALUATION_UNAVAILABLE",
"origin": "TRAVEL",
"message": "Business policy evaluation temporarily unavailable, please retry."
}The request is canceled with the approvals service first, and the trip goes back to being reservable, so it can be sent for approval again or issued. Only an organization admin or the user who booked the trip, or sent it for approval, can withdraw it. A request that is still being created can’t be withdrawn yet, and one that was already approved, denied or issued can’t be withdrawn at all. The answer is
204 No Content in every case that is not an error: read the trip to see where it is. Withdrawing a trip with no open request does nothing.Path Parameters
ID of your realm.
Format: UUID
ID of the organization the trip belongs to.
Format: UUID
ID of the trip whose approval request is withdrawn (24 hexadecimal characters).
Pattern:
^[0-9a-fA-F]{24}$Body
application/json
ID of the approval request that ended. Only the approval service sends it; leave it out when you withdraw a request yourself.
Format: UUID
Example:
"b7f1c0d2-4e3a-4f8b-9c21-7a6d5e4f3b2a"
Response
No Content. The operation succeeded and the response has no body.