getUserWssCredentials
curl --request POST \
--url https://{baseUrl}/ipbox/api/getUserWssCredentials \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data user=user \
--data senha=senhaimport requests
url = "https://{baseUrl}/ipbox/api/getUserWssCredentials"
payload = {
"user": "user",
"senha": "senha"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: '<api-key>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({user: 'user', senha: 'senha'})
};
fetch('https://{baseUrl}/ipbox/api/getUserWssCredentials', 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://{baseUrl}/ipbox/api/getUserWssCredentials",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "user=user&senha=senha",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/x-www-form-urlencoded"
],
]);
$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://{baseUrl}/ipbox/api/getUserWssCredentials"
payload := strings.NewReader("user=user&senha=senha")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{baseUrl}/ipbox/api/getUserWssCredentials")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("user=user&senha=senha")
.asString();require 'uri'
require 'net/http'
url = URI("https://{baseUrl}/ipbox/api/getUserWssCredentials")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "user=user&senha=senha"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"url": "wss://servidor.ipboxcloud.com.br:8089/ws",
"host": "servidor.ipboxcloud.com.br:8089",
"ramal": 2000,
"pass": "senha123",
"ws_port": 8089
}
}Agente
getUserWssCredentials
Obtém dados de conexão do webphone.
Retorna as credenciais websocket do usuário para conexão de webphone.
Retorna:
| Campo | Descrição |
|---|---|
| url | Url completa da conexão websocket |
| host | Host da conexão websocket |
| ramal | Ramal do usuário |
| pass | Senha do websocket |
| port | — não usado — |
Requer que o recurso de WebSocket esteja habilitado no sistema e que o usuário tenha um ramal PJSIP configurado.
São credenciais SIP padrão sobre WebSocket seguro (WSS) — não exclusivas do webphone do IPBoX. Qualquer softphone com suporte a registro via WSS e mídia WebRTC (ICE, DTLS-SRTP) pode usar essas credenciais, desde que suporte pelo menos um dos codecs liberados no ramal: opus ou ulaw.
POST
/
ipbox
/
api
/
getUserWssCredentials
getUserWssCredentials
curl --request POST \
--url https://{baseUrl}/ipbox/api/getUserWssCredentials \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data user=user \
--data senha=senhaimport requests
url = "https://{baseUrl}/ipbox/api/getUserWssCredentials"
payload = {
"user": "user",
"senha": "senha"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: '<api-key>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({user: 'user', senha: 'senha'})
};
fetch('https://{baseUrl}/ipbox/api/getUserWssCredentials', 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://{baseUrl}/ipbox/api/getUserWssCredentials",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "user=user&senha=senha",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/x-www-form-urlencoded"
],
]);
$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://{baseUrl}/ipbox/api/getUserWssCredentials"
payload := strings.NewReader("user=user&senha=senha")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{baseUrl}/ipbox/api/getUserWssCredentials")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("user=user&senha=senha")
.asString();require 'uri'
require 'net/http'
url = URI("https://{baseUrl}/ipbox/api/getUserWssCredentials")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "user=user&senha=senha"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"url": "wss://servidor.ipboxcloud.com.br:8089/ws",
"host": "servidor.ipboxcloud.com.br:8089",
"ramal": 2000,
"pass": "senha123",
"ws_port": 8089
}
}Authorizations
Token gerado em IPBoX > API > Token. Aceita o token puro, ou com prefixo Bearer / Basic.
Body
application/x-www-form-urlencoded
