cURL
curl --request PATCH \
--url https://api.opal.dev/v1/delegations/{delegation_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"start_time": "2023-10-01T12:00:00.000Z",
"end_time": "2023-10-01T12:00:00.000Z"
}
'import requests
url = "https://api.opal.dev/v1/delegations/{delegation_id}"
payload = {
"start_time": "2023-10-01T12:00:00.000Z",
"end_time": "2023-10-01T12:00:00.000Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({start_time: '2023-10-01T12:00:00.000Z', end_time: '2023-10-01T12:00:00.000Z'})
};
fetch('https://api.opal.dev/v1/delegations/{delegation_id}', 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.opal.dev/v1/delegations/{delegation_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'start_time' => '2023-10-01T12:00:00.000Z',
'end_time' => '2023-10-01T12:00:00.000Z'
]),
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.opal.dev/v1/delegations/{delegation_id}"
payload := strings.NewReader("{\n \"start_time\": \"2023-10-01T12:00:00.000Z\",\n \"end_time\": \"2023-10-01T12:00:00.000Z\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.opal.dev/v1/delegations/{delegation_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"start_time\": \"2023-10-01T12:00:00.000Z\",\n \"end_time\": \"2023-10-01T12:00:00.000Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.opal.dev/v1/delegations/{delegation_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"start_time\": \"2023-10-01T12:00:00.000Z\",\n \"end_time\": \"2023-10-01T12:00:00.000Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": "4aed3e8a-727b-4d72-8010-3b8710c50bec",
"delegator_user_id": "123e4567-e89b-12d3-a456-426614174000",
"delegate_user_id": "7c86c85d-0651-43e2-a748-d69d658418e8",
"start_time": "2023-10-01T12:00:00.000Z",
"end_time": "2023-10-01T12:00:00.000Z",
"reason": "I need to be out of the office",
"created_at": "2023-10-01T12:00:00.000Z",
"updated_at": "2023-10-01T12:00:00.000Z"
}Patch delegations
Updates the start and end times of a delegation. Omitted fields keep their current value. The resulting end time must be after the start time and in the future.
PATCH
/
delegations
/
{delegation_id}
cURL
curl --request PATCH \
--url https://api.opal.dev/v1/delegations/{delegation_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"start_time": "2023-10-01T12:00:00.000Z",
"end_time": "2023-10-01T12:00:00.000Z"
}
'import requests
url = "https://api.opal.dev/v1/delegations/{delegation_id}"
payload = {
"start_time": "2023-10-01T12:00:00.000Z",
"end_time": "2023-10-01T12:00:00.000Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({start_time: '2023-10-01T12:00:00.000Z', end_time: '2023-10-01T12:00:00.000Z'})
};
fetch('https://api.opal.dev/v1/delegations/{delegation_id}', 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.opal.dev/v1/delegations/{delegation_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'start_time' => '2023-10-01T12:00:00.000Z',
'end_time' => '2023-10-01T12:00:00.000Z'
]),
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.opal.dev/v1/delegations/{delegation_id}"
payload := strings.NewReader("{\n \"start_time\": \"2023-10-01T12:00:00.000Z\",\n \"end_time\": \"2023-10-01T12:00:00.000Z\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.opal.dev/v1/delegations/{delegation_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"start_time\": \"2023-10-01T12:00:00.000Z\",\n \"end_time\": \"2023-10-01T12:00:00.000Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.opal.dev/v1/delegations/{delegation_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"start_time\": \"2023-10-01T12:00:00.000Z\",\n \"end_time\": \"2023-10-01T12:00:00.000Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": "4aed3e8a-727b-4d72-8010-3b8710c50bec",
"delegator_user_id": "123e4567-e89b-12d3-a456-426614174000",
"delegate_user_id": "7c86c85d-0651-43e2-a748-d69d658418e8",
"start_time": "2023-10-01T12:00:00.000Z",
"end_time": "2023-10-01T12:00:00.000Z",
"reason": "I need to be out of the office",
"created_at": "2023-10-01T12:00:00.000Z",
"updated_at": "2023-10-01T12:00:00.000Z"
}Authorizations
Body
application/json
Request body for updating the start and end times of a delegation. Omitted fields keep their current value. The resulting end time must be after the start time and in the future.
Response
200 - application/json
Delegation updated successfully.
Delegation Object
Description
The Delegation object represents a delegation of access review requests from one user to another.
Usage Example
List from the GET Delegations endpoint.
Get from the GET Delegation endpoint.
Was this page helpful?