cURL
curl --request POST \
--url https://grm-api.vercel.app/grievances \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"description": "<string>",
"category": "<string>",
"user_id": "<string>",
"priority": "medium",
"cpgrams_category": "<string>",
"reformed_top_level_category": "<string>",
"reformed_last_level_category": "<string>",
"reformed_flag": false
}
'import requests
url = "https://grm-api.vercel.app/grievances"
payload = {
"title": "<string>",
"description": "<string>",
"category": "<string>",
"user_id": "<string>",
"priority": "medium",
"cpgrams_category": "<string>",
"reformed_top_level_category": "<string>",
"reformed_last_level_category": "<string>",
"reformed_flag": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
description: '<string>',
category: '<string>',
user_id: '<string>',
priority: 'medium',
cpgrams_category: '<string>',
reformed_top_level_category: '<string>',
reformed_last_level_category: '<string>',
reformed_flag: false
})
};
fetch('https://grm-api.vercel.app/grievances', 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://grm-api.vercel.app/grievances",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'title' => '<string>',
'description' => '<string>',
'category' => '<string>',
'user_id' => '<string>',
'priority' => 'medium',
'cpgrams_category' => '<string>',
'reformed_top_level_category' => '<string>',
'reformed_last_level_category' => '<string>',
'reformed_flag' => false
]),
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://grm-api.vercel.app/grievances"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"category\": \"<string>\",\n \"user_id\": \"<string>\",\n \"priority\": \"medium\",\n \"cpgrams_category\": \"<string>\",\n \"reformed_top_level_category\": \"<string>\",\n \"reformed_last_level_category\": \"<string>\",\n \"reformed_flag\": false\n}")
req, _ := http.NewRequest("POST", 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.post("https://grm-api.vercel.app/grievances")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"category\": \"<string>\",\n \"user_id\": \"<string>\",\n \"priority\": \"medium\",\n \"cpgrams_category\": \"<string>\",\n \"reformed_top_level_category\": \"<string>\",\n \"reformed_last_level_category\": \"<string>\",\n \"reformed_flag\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://grm-api.vercel.app/grievances")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"category\": \"<string>\",\n \"user_id\": \"<string>\",\n \"priority\": \"medium\",\n \"cpgrams_category\": \"<string>\",\n \"reformed_top_level_category\": \"<string>\",\n \"reformed_last_level_category\": \"<string>\",\n \"reformed_flag\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "<string>",
"title": "<string>",
"description": "<string>",
"priority": "<string>",
"user_id": "<string>",
"cpgrams_category": "<string>"
}{
"error": 123,
"message": "<string>"
}{
"error": 123,
"message": "<string>"
}Endpoint Examples
Create Grievance
Creates a new grievance in the Xata database
POST
/
grievances
cURL
curl --request POST \
--url https://grm-api.vercel.app/grievances \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"description": "<string>",
"category": "<string>",
"user_id": "<string>",
"priority": "medium",
"cpgrams_category": "<string>",
"reformed_top_level_category": "<string>",
"reformed_last_level_category": "<string>",
"reformed_flag": false
}
'import requests
url = "https://grm-api.vercel.app/grievances"
payload = {
"title": "<string>",
"description": "<string>",
"category": "<string>",
"user_id": "<string>",
"priority": "medium",
"cpgrams_category": "<string>",
"reformed_top_level_category": "<string>",
"reformed_last_level_category": "<string>",
"reformed_flag": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
description: '<string>',
category: '<string>',
user_id: '<string>',
priority: 'medium',
cpgrams_category: '<string>',
reformed_top_level_category: '<string>',
reformed_last_level_category: '<string>',
reformed_flag: false
})
};
fetch('https://grm-api.vercel.app/grievances', 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://grm-api.vercel.app/grievances",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'title' => '<string>',
'description' => '<string>',
'category' => '<string>',
'user_id' => '<string>',
'priority' => 'medium',
'cpgrams_category' => '<string>',
'reformed_top_level_category' => '<string>',
'reformed_last_level_category' => '<string>',
'reformed_flag' => false
]),
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://grm-api.vercel.app/grievances"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"category\": \"<string>\",\n \"user_id\": \"<string>\",\n \"priority\": \"medium\",\n \"cpgrams_category\": \"<string>\",\n \"reformed_top_level_category\": \"<string>\",\n \"reformed_last_level_category\": \"<string>\",\n \"reformed_flag\": false\n}")
req, _ := http.NewRequest("POST", 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.post("https://grm-api.vercel.app/grievances")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"category\": \"<string>\",\n \"user_id\": \"<string>\",\n \"priority\": \"medium\",\n \"cpgrams_category\": \"<string>\",\n \"reformed_top_level_category\": \"<string>\",\n \"reformed_last_level_category\": \"<string>\",\n \"reformed_flag\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://grm-api.vercel.app/grievances")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"category\": \"<string>\",\n \"user_id\": \"<string>\",\n \"priority\": \"medium\",\n \"cpgrams_category\": \"<string>\",\n \"reformed_top_level_category\": \"<string>\",\n \"reformed_last_level_category\": \"<string>\",\n \"reformed_flag\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "<string>",
"title": "<string>",
"description": "<string>",
"priority": "<string>",
"user_id": "<string>",
"cpgrams_category": "<string>"
}{
"error": 123,
"message": "<string>"
}{
"error": 123,
"message": "<string>"
}Creates a new grievance in the Xata database. This endpoint requires authentication via a bearer token. Required fields include
title, description, category, and user_id. The user must exist in the system, otherwise a 404 error is returned.
The grievance is created with a default status of “pending” and timestamps are automatically generated. Additional fields like priority, cpgrams_category, reformed_top_level_category, reformed_last_level_category, and reformed_flag can be provided as needed.
The response includes the ID of the created grievance and a status message indicating successful creation.Authorizations
Body
application/json
Grievance to add to the system
Response
Grievance created successfully