Refresh the current session
curl --request POST \
--url http://localhost:8081/api/v1/session/refresh \
--cookie __Host-OC-SESSIONID=import requests
url = "http://localhost:8081/api/v1/session/refresh"
headers = {"cookie": "__Host-OC-SESSIONID="}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {cookie: '__Host-OC-SESSIONID='}};
fetch('http://localhost:8081/api/v1/session/refresh', 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 => "8081",
CURLOPT_URL => "http://localhost:8081/api/v1/session/refresh",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_COOKIE => "__Host-OC-SESSIONID=",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:8081/api/v1/session/refresh"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("cookie", "__Host-OC-SESSIONID=")
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:8081/api/v1/session/refresh")
.header("cookie", "__Host-OC-SESSIONID=")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8081/api/v1/session/refresh")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["cookie"] = '__Host-OC-SESSIONID='
response = http.request(request)
puts response.read_body{
"expiresAt": "2023-11-07T05:31:56Z"
}{
"error": "the requested resource is not available to this caller",
"reason": "credential_rejected",
"requires": "<string>"
}{
"error": "the requested resource is not available to this caller",
"reason": "credential_rejected",
"requires": "<string>"
}{
"error": "the requested resource is not available to this caller",
"reason": "credential_rejected",
"requires": "<string>"
}Sessions
Refresh the current session
Renew during recent foreground activity, at most once every 30 minutes per tab, with one request in flight. Let the browser manage the session cookie. JavaScript does not need access to the credential. Background polling and event streams do not renew sessions. A session expires after 12 hours without renewal or seven days after sign-in. On 401, preserve the current location and prompt for sign-in. A 503 indicates temporary unavailability.
POST
/
api
/
v1
/
session
/
refresh
Refresh the current session
curl --request POST \
--url http://localhost:8081/api/v1/session/refresh \
--cookie __Host-OC-SESSIONID=import requests
url = "http://localhost:8081/api/v1/session/refresh"
headers = {"cookie": "__Host-OC-SESSIONID="}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {cookie: '__Host-OC-SESSIONID='}};
fetch('http://localhost:8081/api/v1/session/refresh', 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 => "8081",
CURLOPT_URL => "http://localhost:8081/api/v1/session/refresh",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_COOKIE => "__Host-OC-SESSIONID=",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:8081/api/v1/session/refresh"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("cookie", "__Host-OC-SESSIONID=")
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:8081/api/v1/session/refresh")
.header("cookie", "__Host-OC-SESSIONID=")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8081/api/v1/session/refresh")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["cookie"] = '__Host-OC-SESSIONID='
response = http.request(request)
puts response.read_body{
"expiresAt": "2023-11-07T05:31:56Z"
}{
"error": "the requested resource is not available to this caller",
"reason": "credential_rejected",
"requires": "<string>"
}{
"error": "the requested resource is not available to this caller",
"reason": "credential_rejected",
"requires": "<string>"
}{
"error": "the requested resource is not available to this caller",
"reason": "credential_rejected",
"requires": "<string>"
}