cURL
curl --request POST \
--url https://us.api.flexprice.io/v1/analytics/query \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"definition": {
"metrics": [],
"currency": "<string>",
"dimensions": [
"<string>"
],
"filters": [
{
"field": "<string>",
"optional": true,
"value": [
"<string>"
]
}
],
"limit": 123,
"sort": [
{
"field": "<string>"
}
],
"time": {
"range": "<string>"
},
"variables": [
{
"default": [
"<string>"
],
"name": "<string>",
"required": true
}
]
},
"variables": {}
}
'from flexprice import Flexprice
with Flexprice(
api_key_auth="<YOUR_API_KEY_HERE>",
) as f_client:
res = f_client.analytics.query_analytics(definition={
"metrics": [
"events_volume",
],
"shape": "scalar",
})
# Handle response
print(res)import { Flexprice } from "@flexprice/sdk";
const flexprice = new Flexprice({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await flexprice.analytics.queryAnalytics({
definition: {
metrics: [
"events_volume",
],
shape: "scalar",
},
});
console.log(result);
}
run();package main
import(
"context"
flexprice "github.com/flexprice/go-sdk/v2"
"github.com/flexprice/go-sdk/v2/models/types"
"log"
)
func main() {
ctx := context.Background()
s := flexprice.New(
flexprice.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Analytics.QueryAnalytics(ctx, types.AnalyticsQueryRequest{
Definition: types.AnalyticsViewDefinition{
Metrics: []types.Metric{
types.MetricEventsVolume,
},
Shape: types.ShapeScalar,
},
})
if err != nil {
log.Fatal(err)
}
if res.AnalyticsQueryResult != nil {
// handle response
}
}{
"columns": [
{
"currency": "<string>",
"name": "<string>",
"role": "dimension",
"type": "string"
}
],
"meta": {
"from": "<string>",
"prev_from": "<string>",
"prev_to": "<string>",
"query_source": "<string>",
"to": "<string>"
},
"rows": [
[
"<string>"
]
]
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}Analytics
Run an ad-hoc analytics query
Resolves the given view definition against the supplied variables and executes it.
POST
/
analytics
/
query
cURL
curl --request POST \
--url https://us.api.flexprice.io/v1/analytics/query \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"definition": {
"metrics": [],
"currency": "<string>",
"dimensions": [
"<string>"
],
"filters": [
{
"field": "<string>",
"optional": true,
"value": [
"<string>"
]
}
],
"limit": 123,
"sort": [
{
"field": "<string>"
}
],
"time": {
"range": "<string>"
},
"variables": [
{
"default": [
"<string>"
],
"name": "<string>",
"required": true
}
]
},
"variables": {}
}
'from flexprice import Flexprice
with Flexprice(
api_key_auth="<YOUR_API_KEY_HERE>",
) as f_client:
res = f_client.analytics.query_analytics(definition={
"metrics": [
"events_volume",
],
"shape": "scalar",
})
# Handle response
print(res)import { Flexprice } from "@flexprice/sdk";
const flexprice = new Flexprice({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await flexprice.analytics.queryAnalytics({
definition: {
metrics: [
"events_volume",
],
shape: "scalar",
},
});
console.log(result);
}
run();package main
import(
"context"
flexprice "github.com/flexprice/go-sdk/v2"
"github.com/flexprice/go-sdk/v2/models/types"
"log"
)
func main() {
ctx := context.Background()
s := flexprice.New(
flexprice.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Analytics.QueryAnalytics(ctx, types.AnalyticsQueryRequest{
Definition: types.AnalyticsViewDefinition{
Metrics: []types.Metric{
types.MetricEventsVolume,
},
Shape: types.ShapeScalar,
},
})
if err != nil {
log.Fatal(err)
}
if res.AnalyticsQueryResult != nil {
// handle response
}
}{
"columns": [
{
"currency": "<string>",
"name": "<string>",
"role": "dimension",
"type": "string"
}
],
"meta": {
"from": "<string>",
"prev_from": "<string>",
"prev_to": "<string>",
"query_source": "<string>",
"to": "<string>"
},
"rows": [
[
"<string>"
]
]
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}Authorizations
Enter your API key in the format x-api-key <api-key>*
Body
application/json
Analytics query request

