Cancel a browser session (data plane)
curl --request POST \
--url https://api.goyappr.com/web-call/cancel \
--header 'x-yappr-web-token: <x-yappr-web-token>'import requests
url = "https://api.goyappr.com/web-call/cancel"
headers = {"x-yappr-web-token": "<x-yappr-web-token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'x-yappr-web-token': '<x-yappr-web-token>'}};
fetch('https://api.goyappr.com/web-call/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.goyappr.com/web-call/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"x-yappr-web-token: <x-yappr-web-token>"
],
]);
$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 := "https://api.goyappr.com/web-call/cancel"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-yappr-web-token", "<x-yappr-web-token>")
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.goyappr.com/web-call/cancel")
.header("x-yappr-web-token", "<x-yappr-web-token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/web-call/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-yappr-web-token"] = '<x-yappr-web-token>'
response = http.request(request)
puts response.read_body{
"status": "cancelled",
"call_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}Browser calls
Cancel a Browser Session
The browser data plane, not the secret-key API: the session's `cancel_url` from POST /calls {"type":"web"}. Authorized by the session token itself, sent as `x-yappr-web-token`, so your server or the page you handed the token to can take back a session nobody will use. Send no body, or `{}`. The token is spent so no browser can use it; an `offer` session's call settles at once as POST /calls/{id}/end settles it. Safe to repeat. Once cancelled, a browser that still presents the token is refused `403 WEB_SESSION_CANCELLED` by the offer and by the call request alike. Once a page has created a call request with the token, this cancels that request as POST /call-requests/{id}/cancel does, and the answer names it (`request_id`).
POST
/
web-call
/
cancel
Cancel a browser session (data plane)
curl --request POST \
--url https://api.goyappr.com/web-call/cancel \
--header 'x-yappr-web-token: <x-yappr-web-token>'import requests
url = "https://api.goyappr.com/web-call/cancel"
headers = {"x-yappr-web-token": "<x-yappr-web-token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'x-yappr-web-token': '<x-yappr-web-token>'}};
fetch('https://api.goyappr.com/web-call/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.goyappr.com/web-call/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"x-yappr-web-token: <x-yappr-web-token>"
],
]);
$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 := "https://api.goyappr.com/web-call/cancel"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-yappr-web-token", "<x-yappr-web-token>")
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.goyappr.com/web-call/cancel")
.header("x-yappr-web-token", "<x-yappr-web-token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/web-call/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-yappr-web-token"] = '<x-yappr-web-token>'
response = http.request(request)
puts response.read_body{
"status": "cancelled",
"call_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}The browser data plane: the session’s
Send no body, or
cancel_url from
POST /calls with "type": "web". It takes back a session
nobody will use, from your server or from the page you handed the token to. It is
authorized by the session token itself, as x-yappr-web-token - never your secret key.
curl -X POST https://api.goyappr.com/web-call/cancel \
-H "x-yappr-web-token: wcs_…"
{ "status": "cancelled", "call_id": "75a8e137-…" }
{}. The token is spent so no browser can use it. An offer session’s
call settles at once, exactly as POST /calls/{id}/end settles
it, and call_id names it; a call_request session answers call_id: null, because its
call does not exist yet. This is the only way to take back a call_request session.
Sending it again answers the same. A token that has already expired answers
"status": "expired": there is nothing left to take back.
A cancelled token stays cancelled. A browser that still presents it is refused
403 WEB_SESSION_CANCELLED by the offer, by
TURN Credentials and by
Create Browser Call Request, so a page can tell a
session you took back from one that ran out.
| Status | Code | When |
|---|---|---|
400 | WEB_SESSION_CANCEL_INVALID | A body with a field in it, or one that is not JSON. Send none, or {}. |
401 | UNAUTHORIZED | No token, or one that is not a session token. |
405 | METHOD_NOT_ALLOWED | Use POST. |
409 | WEB_SESSION_ALREADY_USED | A browser already used this token. End the call it started, or cancel the call request it created with that request’s own cancel_url. |
Response
Cancelled (or already expired). call_id is null for a call_request session. A token that created a call request answers with that request cancelled and its request_id.