Check and run an unsaved report
curl --request POST \
--url https://cool.jobmojito.com/functions/v1/report-preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"definition": {
"schema": "jobmojito.report/v1",
"title": "Weekly hiring pulse",
"filters": {
"period": {
"preset": "last_30_days"
}
},
"blocks": [
{
"id": "headline",
"type": "kpi",
"dataset": "interview_results",
"measures": [
"completed",
"avg_score",
"shortlisted"
],
"compare": "previous_period"
},
{
"id": "trend",
"type": "line",
"title": "Completed per week",
"dataset": "interview_results",
"dimensions": [
{
"field": "date",
"grain": "week"
}
],
"measures": [
"completed"
],
"width": 8
},
{
"id": "by_position",
"type": "table",
"title": "By position",
"dataset": "interview_results",
"dimensions": [
"position"
],
"measures": [
"completed",
"avg_score",
"shortlisted"
],
"sort": [
{
"field": "completed",
"dir": "desc"
}
],
"limit": 25
}
]
},
"merchant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filters": {
"period": {
"preset": "last_30_days"
},
"position_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"interview_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"include_test": true
},
"block_id": "<string>"
}
'import requests
url = "https://cool.jobmojito.com/functions/v1/report-preview"
payload = {
"definition": {
"schema": "jobmojito.report/v1",
"title": "Weekly hiring pulse",
"filters": { "period": { "preset": "last_30_days" } },
"blocks": [
{
"id": "headline",
"type": "kpi",
"dataset": "interview_results",
"measures": ["completed", "avg_score", "shortlisted"],
"compare": "previous_period"
},
{
"id": "trend",
"type": "line",
"title": "Completed per week",
"dataset": "interview_results",
"dimensions": [
{
"field": "date",
"grain": "week"
}
],
"measures": ["completed"],
"width": 8
},
{
"id": "by_position",
"type": "table",
"title": "By position",
"dataset": "interview_results",
"dimensions": ["position"],
"measures": ["completed", "avg_score", "shortlisted"],
"sort": [
{
"field": "completed",
"dir": "desc"
}
],
"limit": 25
}
]
},
"merchant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filters": {
"period": { "preset": "last_30_days" },
"position_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"interview_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"include_test": True
},
"block_id": "<string>"
}
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({
definition: {
schema: 'jobmojito.report/v1',
title: 'Weekly hiring pulse',
filters: {period: {preset: 'last_30_days'}},
blocks: [
{
id: 'headline',
type: 'kpi',
dataset: 'interview_results',
measures: ['completed', 'avg_score', 'shortlisted'],
compare: 'previous_period'
},
{
id: 'trend',
type: 'line',
title: 'Completed per week',
dataset: 'interview_results',
dimensions: [{field: 'date', grain: 'week'}],
measures: ['completed'],
width: 8
},
{
id: 'by_position',
type: 'table',
title: 'By position',
dataset: 'interview_results',
dimensions: ['position'],
measures: ['completed', 'avg_score', 'shortlisted'],
sort: [{field: 'completed', dir: 'desc'}],
limit: 25
}
]
},
merchant_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
filters: {
period: {preset: 'last_30_days'},
position_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
interview_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
include_test: true
},
block_id: '<string>'
})
};
fetch('https://cool.jobmojito.com/functions/v1/report-preview', 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://cool.jobmojito.com/functions/v1/report-preview",
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([
'definition' => [
'schema' => 'jobmojito.report/v1',
'title' => 'Weekly hiring pulse',
'filters' => [
'period' => [
'preset' => 'last_30_days'
]
],
'blocks' => [
[
'id' => 'headline',
'type' => 'kpi',
'dataset' => 'interview_results',
'measures' => [
'completed',
'avg_score',
'shortlisted'
],
'compare' => 'previous_period'
],
[
'id' => 'trend',
'type' => 'line',
'title' => 'Completed per week',
'dataset' => 'interview_results',
'dimensions' => [
[
'field' => 'date',
'grain' => 'week'
]
],
'measures' => [
'completed'
],
'width' => 8
],
[
'id' => 'by_position',
'type' => 'table',
'title' => 'By position',
'dataset' => 'interview_results',
'dimensions' => [
'position'
],
'measures' => [
'completed',
'avg_score',
'shortlisted'
],
'sort' => [
[
'field' => 'completed',
'dir' => 'desc'
]
],
'limit' => 25
]
]
],
'merchant_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'filters' => [
'period' => [
'preset' => 'last_30_days'
],
'position_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'interview_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'include_test' => true
],
'block_id' => '<string>'
]),
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://cool.jobmojito.com/functions/v1/report-preview"
payload := strings.NewReader("{\n \"definition\": {\n \"schema\": \"jobmojito.report/v1\",\n \"title\": \"Weekly hiring pulse\",\n \"filters\": {\n \"period\": {\n \"preset\": \"last_30_days\"\n }\n },\n \"blocks\": [\n {\n \"id\": \"headline\",\n \"type\": \"kpi\",\n \"dataset\": \"interview_results\",\n \"measures\": [\n \"completed\",\n \"avg_score\",\n \"shortlisted\"\n ],\n \"compare\": \"previous_period\"\n },\n {\n \"id\": \"trend\",\n \"type\": \"line\",\n \"title\": \"Completed per week\",\n \"dataset\": \"interview_results\",\n \"dimensions\": [\n {\n \"field\": \"date\",\n \"grain\": \"week\"\n }\n ],\n \"measures\": [\n \"completed\"\n ],\n \"width\": 8\n },\n {\n \"id\": \"by_position\",\n \"type\": \"table\",\n \"title\": \"By position\",\n \"dataset\": \"interview_results\",\n \"dimensions\": [\n \"position\"\n ],\n \"measures\": [\n \"completed\",\n \"avg_score\",\n \"shortlisted\"\n ],\n \"sort\": [\n {\n \"field\": \"completed\",\n \"dir\": \"desc\"\n }\n ],\n \"limit\": 25\n }\n ]\n },\n \"merchant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"filters\": {\n \"period\": {\n \"preset\": \"last_30_days\"\n },\n \"position_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"interview_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"include_test\": true\n },\n \"block_id\": \"<string>\"\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://cool.jobmojito.com/functions/v1/report-preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"definition\": {\n \"schema\": \"jobmojito.report/v1\",\n \"title\": \"Weekly hiring pulse\",\n \"filters\": {\n \"period\": {\n \"preset\": \"last_30_days\"\n }\n },\n \"blocks\": [\n {\n \"id\": \"headline\",\n \"type\": \"kpi\",\n \"dataset\": \"interview_results\",\n \"measures\": [\n \"completed\",\n \"avg_score\",\n \"shortlisted\"\n ],\n \"compare\": \"previous_period\"\n },\n {\n \"id\": \"trend\",\n \"type\": \"line\",\n \"title\": \"Completed per week\",\n \"dataset\": \"interview_results\",\n \"dimensions\": [\n {\n \"field\": \"date\",\n \"grain\": \"week\"\n }\n ],\n \"measures\": [\n \"completed\"\n ],\n \"width\": 8\n },\n {\n \"id\": \"by_position\",\n \"type\": \"table\",\n \"title\": \"By position\",\n \"dataset\": \"interview_results\",\n \"dimensions\": [\n \"position\"\n ],\n \"measures\": [\n \"completed\",\n \"avg_score\",\n \"shortlisted\"\n ],\n \"sort\": [\n {\n \"field\": \"completed\",\n \"dir\": \"desc\"\n }\n ],\n \"limit\": 25\n }\n ]\n },\n \"merchant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"filters\": {\n \"period\": {\n \"preset\": \"last_30_days\"\n },\n \"position_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"interview_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"include_test\": true\n },\n \"block_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cool.jobmojito.com/functions/v1/report-preview")
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 \"definition\": {\n \"schema\": \"jobmojito.report/v1\",\n \"title\": \"Weekly hiring pulse\",\n \"filters\": {\n \"period\": {\n \"preset\": \"last_30_days\"\n }\n },\n \"blocks\": [\n {\n \"id\": \"headline\",\n \"type\": \"kpi\",\n \"dataset\": \"interview_results\",\n \"measures\": [\n \"completed\",\n \"avg_score\",\n \"shortlisted\"\n ],\n \"compare\": \"previous_period\"\n },\n {\n \"id\": \"trend\",\n \"type\": \"line\",\n \"title\": \"Completed per week\",\n \"dataset\": \"interview_results\",\n \"dimensions\": [\n {\n \"field\": \"date\",\n \"grain\": \"week\"\n }\n ],\n \"measures\": [\n \"completed\"\n ],\n \"width\": 8\n },\n {\n \"id\": \"by_position\",\n \"type\": \"table\",\n \"title\": \"By position\",\n \"dataset\": \"interview_results\",\n \"dimensions\": [\n \"position\"\n ],\n \"measures\": [\n \"completed\",\n \"avg_score\",\n \"shortlisted\"\n ],\n \"sort\": [\n {\n \"field\": \"completed\",\n \"dir\": \"desc\"\n }\n ],\n \"limit\": 25\n }\n ]\n },\n \"merchant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"filters\": {\n \"period\": {\n \"preset\": \"last_30_days\"\n },\n \"position_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"interview_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"include_test\": true\n },\n \"block_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"filters": {},
"blocks": [
{
"block_id": "<string>",
"ok": true,
"columns": [
{}
],
"rows": [
{}
],
"truncated": true,
"previous": {},
"period": {},
"error": "<string>"
}
],
"report_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"version": 123
}{
"error": "Field is required.",
"name": "interview_result_id"
}{
"error": "Field is required.",
"name": "interview_result_id"
}{
"error": "Field is required.",
"name": "interview_result_id"
}{
"error": "Field is required.",
"name": "interview_result_id"
}Reports
Check and run an unsaved report
Validates a report definition against the catalogue and runs it, without storing anything. Use it to check a definition before create_report or update_report. A 422 names the block and field that is wrong and lists the valid ids.
POST
/
report-preview
Check and run an unsaved report
curl --request POST \
--url https://cool.jobmojito.com/functions/v1/report-preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"definition": {
"schema": "jobmojito.report/v1",
"title": "Weekly hiring pulse",
"filters": {
"period": {
"preset": "last_30_days"
}
},
"blocks": [
{
"id": "headline",
"type": "kpi",
"dataset": "interview_results",
"measures": [
"completed",
"avg_score",
"shortlisted"
],
"compare": "previous_period"
},
{
"id": "trend",
"type": "line",
"title": "Completed per week",
"dataset": "interview_results",
"dimensions": [
{
"field": "date",
"grain": "week"
}
],
"measures": [
"completed"
],
"width": 8
},
{
"id": "by_position",
"type": "table",
"title": "By position",
"dataset": "interview_results",
"dimensions": [
"position"
],
"measures": [
"completed",
"avg_score",
"shortlisted"
],
"sort": [
{
"field": "completed",
"dir": "desc"
}
],
"limit": 25
}
]
},
"merchant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filters": {
"period": {
"preset": "last_30_days"
},
"position_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"interview_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"include_test": true
},
"block_id": "<string>"
}
'import requests
url = "https://cool.jobmojito.com/functions/v1/report-preview"
payload = {
"definition": {
"schema": "jobmojito.report/v1",
"title": "Weekly hiring pulse",
"filters": { "period": { "preset": "last_30_days" } },
"blocks": [
{
"id": "headline",
"type": "kpi",
"dataset": "interview_results",
"measures": ["completed", "avg_score", "shortlisted"],
"compare": "previous_period"
},
{
"id": "trend",
"type": "line",
"title": "Completed per week",
"dataset": "interview_results",
"dimensions": [
{
"field": "date",
"grain": "week"
}
],
"measures": ["completed"],
"width": 8
},
{
"id": "by_position",
"type": "table",
"title": "By position",
"dataset": "interview_results",
"dimensions": ["position"],
"measures": ["completed", "avg_score", "shortlisted"],
"sort": [
{
"field": "completed",
"dir": "desc"
}
],
"limit": 25
}
]
},
"merchant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filters": {
"period": { "preset": "last_30_days" },
"position_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"interview_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"include_test": True
},
"block_id": "<string>"
}
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({
definition: {
schema: 'jobmojito.report/v1',
title: 'Weekly hiring pulse',
filters: {period: {preset: 'last_30_days'}},
blocks: [
{
id: 'headline',
type: 'kpi',
dataset: 'interview_results',
measures: ['completed', 'avg_score', 'shortlisted'],
compare: 'previous_period'
},
{
id: 'trend',
type: 'line',
title: 'Completed per week',
dataset: 'interview_results',
dimensions: [{field: 'date', grain: 'week'}],
measures: ['completed'],
width: 8
},
{
id: 'by_position',
type: 'table',
title: 'By position',
dataset: 'interview_results',
dimensions: ['position'],
measures: ['completed', 'avg_score', 'shortlisted'],
sort: [{field: 'completed', dir: 'desc'}],
limit: 25
}
]
},
merchant_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
filters: {
period: {preset: 'last_30_days'},
position_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
interview_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
include_test: true
},
block_id: '<string>'
})
};
fetch('https://cool.jobmojito.com/functions/v1/report-preview', 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://cool.jobmojito.com/functions/v1/report-preview",
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([
'definition' => [
'schema' => 'jobmojito.report/v1',
'title' => 'Weekly hiring pulse',
'filters' => [
'period' => [
'preset' => 'last_30_days'
]
],
'blocks' => [
[
'id' => 'headline',
'type' => 'kpi',
'dataset' => 'interview_results',
'measures' => [
'completed',
'avg_score',
'shortlisted'
],
'compare' => 'previous_period'
],
[
'id' => 'trend',
'type' => 'line',
'title' => 'Completed per week',
'dataset' => 'interview_results',
'dimensions' => [
[
'field' => 'date',
'grain' => 'week'
]
],
'measures' => [
'completed'
],
'width' => 8
],
[
'id' => 'by_position',
'type' => 'table',
'title' => 'By position',
'dataset' => 'interview_results',
'dimensions' => [
'position'
],
'measures' => [
'completed',
'avg_score',
'shortlisted'
],
'sort' => [
[
'field' => 'completed',
'dir' => 'desc'
]
],
'limit' => 25
]
]
],
'merchant_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'filters' => [
'period' => [
'preset' => 'last_30_days'
],
'position_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'interview_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'include_test' => true
],
'block_id' => '<string>'
]),
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://cool.jobmojito.com/functions/v1/report-preview"
payload := strings.NewReader("{\n \"definition\": {\n \"schema\": \"jobmojito.report/v1\",\n \"title\": \"Weekly hiring pulse\",\n \"filters\": {\n \"period\": {\n \"preset\": \"last_30_days\"\n }\n },\n \"blocks\": [\n {\n \"id\": \"headline\",\n \"type\": \"kpi\",\n \"dataset\": \"interview_results\",\n \"measures\": [\n \"completed\",\n \"avg_score\",\n \"shortlisted\"\n ],\n \"compare\": \"previous_period\"\n },\n {\n \"id\": \"trend\",\n \"type\": \"line\",\n \"title\": \"Completed per week\",\n \"dataset\": \"interview_results\",\n \"dimensions\": [\n {\n \"field\": \"date\",\n \"grain\": \"week\"\n }\n ],\n \"measures\": [\n \"completed\"\n ],\n \"width\": 8\n },\n {\n \"id\": \"by_position\",\n \"type\": \"table\",\n \"title\": \"By position\",\n \"dataset\": \"interview_results\",\n \"dimensions\": [\n \"position\"\n ],\n \"measures\": [\n \"completed\",\n \"avg_score\",\n \"shortlisted\"\n ],\n \"sort\": [\n {\n \"field\": \"completed\",\n \"dir\": \"desc\"\n }\n ],\n \"limit\": 25\n }\n ]\n },\n \"merchant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"filters\": {\n \"period\": {\n \"preset\": \"last_30_days\"\n },\n \"position_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"interview_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"include_test\": true\n },\n \"block_id\": \"<string>\"\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://cool.jobmojito.com/functions/v1/report-preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"definition\": {\n \"schema\": \"jobmojito.report/v1\",\n \"title\": \"Weekly hiring pulse\",\n \"filters\": {\n \"period\": {\n \"preset\": \"last_30_days\"\n }\n },\n \"blocks\": [\n {\n \"id\": \"headline\",\n \"type\": \"kpi\",\n \"dataset\": \"interview_results\",\n \"measures\": [\n \"completed\",\n \"avg_score\",\n \"shortlisted\"\n ],\n \"compare\": \"previous_period\"\n },\n {\n \"id\": \"trend\",\n \"type\": \"line\",\n \"title\": \"Completed per week\",\n \"dataset\": \"interview_results\",\n \"dimensions\": [\n {\n \"field\": \"date\",\n \"grain\": \"week\"\n }\n ],\n \"measures\": [\n \"completed\"\n ],\n \"width\": 8\n },\n {\n \"id\": \"by_position\",\n \"type\": \"table\",\n \"title\": \"By position\",\n \"dataset\": \"interview_results\",\n \"dimensions\": [\n \"position\"\n ],\n \"measures\": [\n \"completed\",\n \"avg_score\",\n \"shortlisted\"\n ],\n \"sort\": [\n {\n \"field\": \"completed\",\n \"dir\": \"desc\"\n }\n ],\n \"limit\": 25\n }\n ]\n },\n \"merchant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"filters\": {\n \"period\": {\n \"preset\": \"last_30_days\"\n },\n \"position_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"interview_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"include_test\": true\n },\n \"block_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cool.jobmojito.com/functions/v1/report-preview")
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 \"definition\": {\n \"schema\": \"jobmojito.report/v1\",\n \"title\": \"Weekly hiring pulse\",\n \"filters\": {\n \"period\": {\n \"preset\": \"last_30_days\"\n }\n },\n \"blocks\": [\n {\n \"id\": \"headline\",\n \"type\": \"kpi\",\n \"dataset\": \"interview_results\",\n \"measures\": [\n \"completed\",\n \"avg_score\",\n \"shortlisted\"\n ],\n \"compare\": \"previous_period\"\n },\n {\n \"id\": \"trend\",\n \"type\": \"line\",\n \"title\": \"Completed per week\",\n \"dataset\": \"interview_results\",\n \"dimensions\": [\n {\n \"field\": \"date\",\n \"grain\": \"week\"\n }\n ],\n \"measures\": [\n \"completed\"\n ],\n \"width\": 8\n },\n {\n \"id\": \"by_position\",\n \"type\": \"table\",\n \"title\": \"By position\",\n \"dataset\": \"interview_results\",\n \"dimensions\": [\n \"position\"\n ],\n \"measures\": [\n \"completed\",\n \"avg_score\",\n \"shortlisted\"\n ],\n \"sort\": [\n {\n \"field\": \"completed\",\n \"dir\": \"desc\"\n }\n ],\n \"limit\": 25\n }\n ]\n },\n \"merchant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"filters\": {\n \"period\": {\n \"preset\": \"last_30_days\"\n },\n \"position_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"interview_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"include_test\": true\n },\n \"block_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"filters": {},
"blocks": [
{
"block_id": "<string>",
"ok": true,
"columns": [
{}
],
"rows": [
{}
],
"truncated": true,
"previous": {},
"period": {},
"error": "<string>"
}
],
"report_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"version": 123
}{
"error": "Field is required.",
"name": "interview_result_id"
}{
"error": "Field is required.",
"name": "interview_result_id"
}{
"error": "Field is required.",
"name": "interview_result_id"
}{
"error": "Field is required.",
"name": "interview_result_id"
}Authorizations
Supabase JWT — Authorization: Bearer <token>.
Body
application/json
A custom report: report-wide filters and up to 12 blocks. Read report-catalog first for the dataset, field and measure ids.
Show child attributes
Show child attributes
Example:
{
"schema": "jobmojito.report/v1",
"title": "Weekly hiring pulse",
"filters": { "period": { "preset": "last_30_days" } },
"blocks": [
{
"id": "headline",
"type": "kpi",
"dataset": "interview_results",
"measures": ["completed", "avg_score", "shortlisted"],
"compare": "previous_period"
},
{
"id": "trend",
"type": "line",
"title": "Completed per week",
"dataset": "interview_results",
"dimensions": [{ "field": "date", "grain": "week" }],
"measures": ["completed"],
"width": 8
},
{
"id": "by_position",
"type": "table",
"title": "By position",
"dataset": "interview_results",
"dimensions": ["position"],
"measures": ["completed", "avg_score", "shortlisted"],
"sort": [{ "field": "completed", "dir": "desc" }],
"limit": 25
}
]
}
Optional merchant to act on. Admins and sub-merchant operators only; other callers always use their token's merchant.
Applied on top of definition.filters.
Show child attributes
Show child attributes
Run only this block.