Appearance
User - Tickets
Base URL:
https://your-domain.com
Admin endpoints for managing support tickets. All endpoints require admin/staff authentication.
Fetch All Tickets
Retrieve all support tickets with optional filters.
| Property | Value |
|---|---|
| Endpoint | Fetch All Tickets |
| Method | GET |
| URL | /api/v1/tickets |
| Authentication | Bearer Token |
Request Headers:
| Header | Value | Required |
|---|---|---|
Accept | application/json | Yes |
Authorization | Bearer your-auth-token | Yes |
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
isp_id | integer | Yes | ISP ID |
branch_id | integer | Yes | Branch ID |
user_id | integer | Yes | User ID |
status | integer | No | Filter by status (0=Open, 1=In Progress, 2=Resolved, 3=Closed) |
priority | integer | No | Filter by priority (1=Low, 2=Medium, 3=High) |
Success Response (200 OK):
json
{
"success": true,
"data": [
{
"id": 1,
"title": "Connection Issue",
"subscriber_id": 1,
"subscriber_name": "John Doe",
"priority": 2,
"status": 0,
"created_at": "2024-01-15 10:30:00"
}
]
}Code Examples:
bash
curl -X GET "https://your-domain.com/api/v1/tickets?isp_id=1&branch_id=1&user_id=1" \
-H "Accept: application/json" \
-H "Authorization: Bearer your-auth-token"php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$response = $client->request('GET', '/api/v1/tickets', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
'query' => [
'isp_id' => 1,
'branch_id' => 1,
'user_id' => 1,
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const params = new URLSearchParams({
isp_id: 1,
branch_id: 1,
user_id: 1,
});
const response = await fetch(`${BASE_URL}/api/v1/tickets?${params}`, {
method: 'GET',
headers: {
Accept: 'application/json',
Authorization: `Bearer ${TOKEN}`,
},
});
const data = await response.json();
console.log(data);python
import requests
BASE_URL = "https://your-domain.com"
TOKEN = "your-auth-token"
response = requests.get(
f"{BASE_URL}/api/v1/tickets",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
params={
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
},
)
data = response.json()
print(data)go
package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
endpoint := baseURL + "/api/v1/tickets"
q := url.Values{}
q.Set("isp_id", "1")
q.Set("branch_id", "1")
q.Set("user_id", "1")
endpoint += "?" + q.Encode()
req, _ := http.NewRequest("GET", endpoint, nil)
req.Header.Set("Accept", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(body))
}rust
use reqwest::Client;
const BASE_URL: &str = "https://your-domain.com";
const TOKEN: &str = "your-auth-token";
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let response = client
.get(format!("{BASE_URL}/api/v1/tickets"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.query(&[
("isp_id", "1"),
("branch_id", "1"),
("user_id", "1"),
])
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Fetch Ticket
Retrieve details of a specific ticket including replies.
| Property | Value |
|---|---|
| Endpoint | Fetch Ticket |
| Method | GET |
| URL | /api/v1/tickets/{id} |
| Authentication | Bearer Token |
Success Response (200 OK):
json
{
"success": true,
"data": {
"id": 1,
"title": "Connection Issue",
"description": "Cannot connect to internet",
"subscriber_id": 1,
"subscriber_name": "John Doe",
"priority": 2,
"status": 0,
"replies": [
{
"id": 1,
"message": "We are looking into this.",
"user_name": "Admin",
"created_at": "2024-01-15 11:00:00"
}
],
"created_at": "2024-01-15 10:30:00"
}
}Code Examples:
bash
curl -X GET "https://your-domain.com/api/v1/tickets/1" \
-H "Accept: application/json" \
-H "Authorization: Bearer your-auth-token"php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$ticketId = 1;
$response = $client->request('GET', "/api/v1/tickets/{$ticketId}", [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const ticketId = 1;
const response = await fetch(`${BASE_URL}/api/v1/tickets/${ticketId}`, {
method: 'GET',
headers: {
Accept: 'application/json',
Authorization: `Bearer ${TOKEN}`,
},
});
const data = await response.json();
console.log(data);python
import requests
BASE_URL = "https://your-domain.com"
TOKEN = "your-auth-token"
ticket_id = 1
response = requests.get(
f"{BASE_URL}/api/v1/tickets/{ticket_id}",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
)
data = response.json()
print(data)go
package main
import (
"fmt"
"io"
"net/http"
"strconv"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
ticketId := 1
endpoint := baseURL + "/api/v1/tickets/" + strconv.Itoa(ticketId)
req, _ := http.NewRequest("GET", endpoint, nil)
req.Header.Set("Accept", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(body))
}rust
use reqwest::Client;
const BASE_URL: &str = "https://your-domain.com";
const TOKEN: &str = "your-auth-token";
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let ticket_id = 1;
let response = client
.get(format!("{BASE_URL}/api/v1/tickets/{ticket_id}"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Create Ticket
Create a new support ticket.
| Property | Value |
|---|---|
| Endpoint | Create Ticket |
| Method | POST |
| URL | /api/v1/tickets |
| Authentication | Bearer Token |
Request Body:
json
{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"subscriber_id": 1,
"title": "Connection Issue",
"description": "Cannot connect to internet",
"priority": 2
}| Parameter | Type | Required | Description |
|---|---|---|---|
title | string | Yes | Ticket title |
description | string | Yes | Issue description |
subscriber_id | integer | No | Related subscriber |
priority | integer | Yes | 1=Low, 2=Medium, 3=High |
Success Response (201 Created):
json
{
"success": true,
"message": "Ticket created successfully",
"data": {
"id": 1
}
}Code Examples:
bash
curl -X POST "https://your-domain.com/api/v1/tickets" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-auth-token" \
-d '{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"subscriber_id": 1,
"title": "Connection Issue",
"description": "Cannot connect to internet",
"priority": 2
}'php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$response = $client->request('POST', '/api/v1/tickets', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
'json' => [
'isp_id' => 1,
'branch_id' => 1,
'user_id' => 1,
'subscriber_id' => 1,
'title' => 'Connection Issue',
'description' => 'Cannot connect to internet',
'priority' => 2,
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const response = await fetch(`${BASE_URL}/api/v1/tickets`, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Authorization: `Bearer ${TOKEN}`,
},
body: JSON.stringify({
isp_id: 1,
branch_id: 1,
user_id: 1,
subscriber_id: 1,
title: 'Connection Issue',
description: 'Cannot connect to internet',
priority: 2,
}),
});
const data = await response.json();
console.log(data);python
import requests
BASE_URL = "https://your-domain.com"
TOKEN = "your-auth-token"
response = requests.post(
f"{BASE_URL}/api/v1/tickets",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
json={
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"subscriber_id": 1,
"title": "Connection Issue",
"description": "Cannot connect to internet",
"priority": 2,
},
)
data = response.json()
print(data)go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
endpoint := baseURL + "/api/v1/tickets"
payload, _ := json.Marshal(map[string]any{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"subscriber_id": 1,
"title": "Connection Issue",
"description": "Cannot connect to internet",
"priority": 2,
})
req, _ := http.NewRequest("POST", endpoint, bytes.NewBuffer(payload))
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(body))
}rust
use reqwest::Client;
use serde_json::json;
const BASE_URL: &str = "https://your-domain.com";
const TOKEN: &str = "your-auth-token";
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let response = client
.post(format!("{BASE_URL}/api/v1/tickets"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.json(&json!({
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"subscriber_id": 1,
"title": "Connection Issue",
"description": "Cannot connect to internet",
"priority": 2
}))
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Update Ticket
Update ticket details.
| Property | Value |
|---|---|
| Endpoint | Update Ticket |
| Method | PUT |
| URL | /api/v1/tickets/{id} |
| Authentication | Bearer Token |
Request Body:
json
{
"title": "Updated Title",
"priority": 3
}Success Response (200 OK):
json
{
"success": true,
"message": "Ticket updated successfully"
}Code Examples:
bash
curl -X PUT "https://your-domain.com/api/v1/tickets/1" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-auth-token" \
-d '{
"title": "Updated Title",
"priority": 3
}'php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$ticketId = 1;
$response = $client->request('PUT', "/api/v1/tickets/{$ticketId}", [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
'json' => [
'title' => 'Updated Title',
'priority' => 3,
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const ticketId = 1;
const response = await fetch(`${BASE_URL}/api/v1/tickets/${ticketId}`, {
method: 'PUT',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Authorization: `Bearer ${TOKEN}`,
},
body: JSON.stringify({
title: 'Updated Title',
priority: 3,
}),
});
const data = await response.json();
console.log(data);python
import requests
BASE_URL = "https://your-domain.com"
TOKEN = "your-auth-token"
ticket_id = 1
response = requests.put(
f"{BASE_URL}/api/v1/tickets/{ticket_id}",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
json={
"title": "Updated Title",
"priority": 3,
},
)
data = response.json()
print(data)go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"strconv"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
ticketId := 1
endpoint := baseURL + "/api/v1/tickets/" + strconv.Itoa(ticketId)
payload, _ := json.Marshal(map[string]any{
"title": "Updated Title",
"priority": 3,
})
req, _ := http.NewRequest("PUT", endpoint, bytes.NewBuffer(payload))
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(body))
}rust
use reqwest::Client;
use serde_json::json;
const BASE_URL: &str = "https://your-domain.com";
const TOKEN: &str = "your-auth-token";
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let ticket_id = 1;
let response = client
.put(format!("{BASE_URL}/api/v1/tickets/{ticket_id}"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.json(&json!({
"title": "Updated Title",
"priority": 3
}))
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Delete Ticket
Delete a support ticket.
| Property | Value |
|---|---|
| Endpoint | Delete Ticket |
| Method | DELETE |
| URL | /api/v1/tickets/{id} |
| Authentication | Bearer Token |
Success Response (200 OK):
json
{
"success": true,
"message": "Ticket deleted successfully"
}Code Examples:
bash
curl -X DELETE "https://your-domain.com/api/v1/tickets/1" \
-H "Accept: application/json" \
-H "Authorization: Bearer your-auth-token"php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$ticketId = 1;
$response = $client->request('DELETE', "/api/v1/tickets/{$ticketId}", [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const ticketId = 1;
const response = await fetch(`${BASE_URL}/api/v1/tickets/${ticketId}`, {
method: 'DELETE',
headers: {
Accept: 'application/json',
Authorization: `Bearer ${TOKEN}`,
},
});
const data = await response.json();
console.log(data);python
import requests
BASE_URL = "https://your-domain.com"
TOKEN = "your-auth-token"
ticket_id = 1
response = requests.delete(
f"{BASE_URL}/api/v1/tickets/{ticket_id}",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
)
data = response.json()
print(data)go
package main
import (
"fmt"
"io"
"net/http"
"strconv"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
ticketId := 1
endpoint := baseURL + "/api/v1/tickets/" + strconv.Itoa(ticketId)
req, _ := http.NewRequest("DELETE", endpoint, nil)
req.Header.Set("Accept", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(body))
}rust
use reqwest::Client;
const BASE_URL: &str = "https://your-domain.com";
const TOKEN: &str = "your-auth-token";
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let ticket_id = 1;
let response = client
.delete(format!("{BASE_URL}/api/v1/tickets/{ticket_id}"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Reply to Ticket
Add a reply to a ticket.
| Property | Value |
|---|---|
| Endpoint | Reply to Ticket |
| Method | POST |
| URL | /api/v1/tickets/{id}/reply |
| Authentication | Bearer Token |
Request Body:
json
{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"message": "We are looking into this issue."
}Success Response (201 Created):
json
{
"success": true,
"message": "Reply added successfully"
}Code Examples:
bash
curl -X POST "https://your-domain.com/api/v1/tickets/1/reply" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-auth-token" \
-d '{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"message": "We are looking into this issue."
}'php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$ticketId = 1;
$response = $client->request('POST', "/api/v1/tickets/{$ticketId}/reply", [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
'json' => [
'isp_id' => 1,
'branch_id' => 1,
'user_id' => 1,
'message' => 'We are looking into this issue.',
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const ticketId = 1;
const response = await fetch(`${BASE_URL}/api/v1/tickets/${ticketId}/reply`, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Authorization: `Bearer ${TOKEN}`,
},
body: JSON.stringify({
isp_id: 1,
branch_id: 1,
user_id: 1,
message: 'We are looking into this issue.',
}),
});
const data = await response.json();
console.log(data);python
import requests
BASE_URL = "https://your-domain.com"
TOKEN = "your-auth-token"
ticket_id = 1
response = requests.post(
f"{BASE_URL}/api/v1/tickets/{ticket_id}/reply",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
json={
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"message": "We are looking into this issue.",
},
)
data = response.json()
print(data)go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"strconv"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
ticketId := 1
endpoint := baseURL + "/api/v1/tickets/" + strconv.Itoa(ticketId) + "/reply"
payload, _ := json.Marshal(map[string]any{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"message": "We are looking into this issue.",
})
req, _ := http.NewRequest("POST", endpoint, bytes.NewBuffer(payload))
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(body))
}rust
use reqwest::Client;
use serde_json::json;
const BASE_URL: &str = "https://your-domain.com";
const TOKEN: &str = "your-auth-token";
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let ticket_id = 1;
let response = client
.post(format!("{BASE_URL}/api/v1/tickets/{ticket_id}/reply"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.json(&json!({
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"message": "We are looking into this issue."
}))
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Change Ticket Status
Update the status of a ticket.
| Property | Value |
|---|---|
| Endpoint | Change Ticket Status |
| Method | PUT |
| URL | /api/v1/tickets/{id}/status |
| Authentication | Bearer Token |
Request Body:
json
{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"status": 2
}| Parameter | Type | Required | Description |
|---|---|---|---|
status | integer | Yes | 0=Open, 1=In Progress, 2=Resolved, 3=Closed |
Success Response (200 OK):
json
{
"success": true,
"message": "Ticket status updated successfully"
}Code Examples:
bash
curl -X PUT "https://your-domain.com/api/v1/tickets/1/status" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-auth-token" \
-d '{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"status": 2
}'php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$ticketId = 1;
$response = $client->request('PUT', "/api/v1/tickets/{$ticketId}/status", [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
'json' => [
'isp_id' => 1,
'branch_id' => 1,
'user_id' => 1,
'status' => 2,
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const ticketId = 1;
const response = await fetch(`${BASE_URL}/api/v1/tickets/${ticketId}/status`, {
method: 'PUT',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Authorization: `Bearer ${TOKEN}`,
},
body: JSON.stringify({
isp_id: 1,
branch_id: 1,
user_id: 1,
status: 2,
}),
});
const data = await response.json();
console.log(data);python
import requests
BASE_URL = "https://your-domain.com"
TOKEN = "your-auth-token"
ticket_id = 1
response = requests.put(
f"{BASE_URL}/api/v1/tickets/{ticket_id}/status",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
json={
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"status": 2,
},
)
data = response.json()
print(data)go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"strconv"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
ticketId := 1
endpoint := baseURL + "/api/v1/tickets/" + strconv.Itoa(ticketId) + "/status"
payload, _ := json.Marshal(map[string]any{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"status": 2,
})
req, _ := http.NewRequest("PUT", endpoint, bytes.NewBuffer(payload))
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(body))
}rust
use reqwest::Client;
use serde_json::json;
const BASE_URL: &str = "https://your-domain.com";
const TOKEN: &str = "your-auth-token";
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let ticket_id = 1;
let response = client
.put(format!("{BASE_URL}/api/v1/tickets/{ticket_id}/status"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.json(&json!({
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"status": 2
}))
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}