Premiação
Criar regra de premiação
POST
/
events
/
{event}
/
races
/
{race}
/
prize-rules
Criar regra de premiação
curl --request POST \
--url http://localhost/api/v1/events/{event}/races/{race}/prize-rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"seq": 500,
"ranking_cut": 500,
"modality_id": 123,
"dupla_prem": [
"<string>"
],
"eqp_n_melhores": 500
}
'import requests
url = "http://localhost/api/v1/events/{event}/races/{race}/prize-rules"
payload = {
"seq": 500,
"ranking_cut": 500,
"modality_id": 123,
"dupla_prem": ["<string>"],
"eqp_n_melhores": 500
}
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({
seq: 500,
ranking_cut: 500,
modality_id: 123,
dupla_prem: ['<string>'],
eqp_n_melhores: 500
})
};
fetch('http://localhost/api/v1/events/{event}/races/{race}/prize-rules', 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 => "http://localhost/api/v1/events/{event}/races/{race}/prize-rules",
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([
'seq' => 500,
'ranking_cut' => 500,
'modality_id' => 123,
'dupla_prem' => [
'<string>'
],
'eqp_n_melhores' => 500
]),
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 := "http://localhost/api/v1/events/{event}/races/{race}/prize-rules"
payload := strings.NewReader("{\n \"seq\": 500,\n \"ranking_cut\": 500,\n \"modality_id\": 123,\n \"dupla_prem\": [\n \"<string>\"\n ],\n \"eqp_n_melhores\": 500\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("http://localhost/api/v1/events/{event}/races/{race}/prize-rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"seq\": 500,\n \"ranking_cut\": 500,\n \"modality_id\": 123,\n \"dupla_prem\": [\n \"<string>\"\n ],\n \"eqp_n_melhores\": 500\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost/api/v1/events/{event}/races/{race}/prize-rules")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"seq\": 500,\n \"ranking_cut\": 500,\n \"modality_id\": 123,\n \"dupla_prem\": [\n \"<string>\"\n ],\n \"eqp_n_melhores\": 500\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": 123,
"race_id": 123,
"event_id": 123,
"seq": 123,
"modality_id": 123,
"ranking_type": "<string>",
"ranking_cut": 123,
"gender_filter": "<string>",
"pne_filter": "<string>",
"dupla_prem": [
"<unknown>"
],
"tipo_premiacao": "<string>",
"eqp_apuracao": "<string>",
"eqp_n_melhores": 123,
"eqp_base_ranking": "<string>",
"status": "<string>",
"created_at": "<string>",
"updated_at": "<string>",
"modality": {
"id": 123,
"name": "<string>"
}
}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}Authorizations
API key do hub com escopo manage. Header: Authorization: Bearer <api_key>.
Body
application/json
POST /api/v1/events/{event}/races/{race}/prize-rules — cria regra de premiação.
Espelha RaceView::savePrizeRule (prizeRuleForm) + as constantes de PrizeRule.
dupla_prem é jsonb: aceita ["all"] ou lista de seqs [1,2,3] ou null.
Required range:
1 <= x <= 999Available options:
GERAL, GERAL_GENERO, CATEGORIA, CAT_SECUNDARIA Required range:
1 <= x <= 999Available options:
M, F Available options:
S, N Available options:
IND, EQP Available options:
C, P Required range:
1 <= x <= 999Available options:
GER, GEN Status genérico usado por várias entidades (Hub, User, Group, Category, etc.). Entidades com estados específicos (Event, Registration) têm enums próprios.
Available options:
active, inactive, suspended Response
JsonResource
Show child attributes
Show child attributes
⌘I
Criar regra de premiação
curl --request POST \
--url http://localhost/api/v1/events/{event}/races/{race}/prize-rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"seq": 500,
"ranking_cut": 500,
"modality_id": 123,
"dupla_prem": [
"<string>"
],
"eqp_n_melhores": 500
}
'import requests
url = "http://localhost/api/v1/events/{event}/races/{race}/prize-rules"
payload = {
"seq": 500,
"ranking_cut": 500,
"modality_id": 123,
"dupla_prem": ["<string>"],
"eqp_n_melhores": 500
}
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({
seq: 500,
ranking_cut: 500,
modality_id: 123,
dupla_prem: ['<string>'],
eqp_n_melhores: 500
})
};
fetch('http://localhost/api/v1/events/{event}/races/{race}/prize-rules', 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 => "http://localhost/api/v1/events/{event}/races/{race}/prize-rules",
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([
'seq' => 500,
'ranking_cut' => 500,
'modality_id' => 123,
'dupla_prem' => [
'<string>'
],
'eqp_n_melhores' => 500
]),
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 := "http://localhost/api/v1/events/{event}/races/{race}/prize-rules"
payload := strings.NewReader("{\n \"seq\": 500,\n \"ranking_cut\": 500,\n \"modality_id\": 123,\n \"dupla_prem\": [\n \"<string>\"\n ],\n \"eqp_n_melhores\": 500\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("http://localhost/api/v1/events/{event}/races/{race}/prize-rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"seq\": 500,\n \"ranking_cut\": 500,\n \"modality_id\": 123,\n \"dupla_prem\": [\n \"<string>\"\n ],\n \"eqp_n_melhores\": 500\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost/api/v1/events/{event}/races/{race}/prize-rules")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"seq\": 500,\n \"ranking_cut\": 500,\n \"modality_id\": 123,\n \"dupla_prem\": [\n \"<string>\"\n ],\n \"eqp_n_melhores\": 500\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": 123,
"race_id": 123,
"event_id": 123,
"seq": 123,
"modality_id": 123,
"ranking_type": "<string>",
"ranking_cut": 123,
"gender_filter": "<string>",
"pne_filter": "<string>",
"dupla_prem": [
"<unknown>"
],
"tipo_premiacao": "<string>",
"eqp_apuracao": "<string>",
"eqp_n_melhores": 123,
"eqp_base_ranking": "<string>",
"status": "<string>",
"created_at": "<string>",
"updated_at": "<string>",
"modality": {
"id": 123,
"name": "<string>"
}
}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}