Lista categorias com contadores de serviços e scores de popularidade
curl --request GET \
--url https://services.pref.rio/app-busca-search/api/v1/categories \
--header 'Authorization: Bearer <token>'import requests
url = "https://services.pref.rio/app-busca-search/api/v1/categories"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://services.pref.rio/app-busca-search/api/v1/categories', 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://services.pref.rio/app-busca-search/api/v1/categories",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <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://services.pref.rio/app-busca-search/api/v1/categories"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://services.pref.rio/app-busca-search/api/v1/categories")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://services.pref.rio/app-busca-search/api/v1/categories")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"categories": [
{
"count": 123,
"name": "<string>",
"popularity_score": 123
}
],
"filtered_category": {
"name": "<string>",
"page": 123,
"per_page": 123,
"services": [
{
"category": "<string>",
"created_at": 123,
"description": "<string>",
"id": "<string>",
"metadata": {},
"slug": "<string>",
"status": 123,
"subcategory": "<string>",
"title": "<string>",
"updated_at": 123
}
],
"total_services": 123
},
"metadata": {},
"total_categories": 123
}{}{}categories
Lista categorias com contadores de serviços e scores de popularidade
Endpoint híbrido que retorna lista de categorias ordenadas por popularidade, quantidade de serviços ou ordem alfabética. Permite também filtrar serviços de uma categoria específica em uma única chamada. Scores de popularidade são baseados em dados hardcoded (futura integração com Google Analytics).
Casos de Uso:
- Listar categorias: GET /api/v1/categories
- Ordenar por quantidade: GET /api/v1/categories?sort_by=count&order=desc
- Buscar serviços de categoria: GET /api/v1/categories?filter_category=Educação&page=1&per_page=10
Nota: Quando filter_category é usado, o endpoint retorna tanto a lista de categorias quanto os serviços filtrados.
GET
/
api
/
v1
/
categories
Lista categorias com contadores de serviços e scores de popularidade
curl --request GET \
--url https://services.pref.rio/app-busca-search/api/v1/categories \
--header 'Authorization: Bearer <token>'import requests
url = "https://services.pref.rio/app-busca-search/api/v1/categories"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://services.pref.rio/app-busca-search/api/v1/categories', 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://services.pref.rio/app-busca-search/api/v1/categories",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <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://services.pref.rio/app-busca-search/api/v1/categories"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://services.pref.rio/app-busca-search/api/v1/categories")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://services.pref.rio/app-busca-search/api/v1/categories")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"categories": [
{
"count": 123,
"name": "<string>",
"popularity_score": 123
}
],
"filtered_category": {
"name": "<string>",
"page": 123,
"per_page": 123,
"services": [
{
"category": "<string>",
"created_at": 123,
"description": "<string>",
"id": "<string>",
"metadata": {},
"slug": "<string>",
"status": 123,
"subcategory": "<string>",
"title": "<string>",
"updated_at": 123
}
],
"total_services": 123
},
"metadata": {},
"total_categories": 123
}{}{}