cURL
curl --request PUT \
--url https://us.api.flexprice.io/v1/analytics/views/{id} \
--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
}
]
},
"name": "<string>"
}
'from flexprice import Flexprice
with Flexprice(
api_key_auth="<YOUR_API_KEY_HERE>",
) as f_client:
res = f_client.analytics.update_analytics_view(id="<id>", definition={
"metrics": [],
"shape": "timeseries",
}, name="<value>")
# 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.updateAnalyticsView("<id>", {
definition: {
metrics: [],
shape: "timeseries",
},
name: "<value>",
});
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.UpdateAnalyticsView(ctx, "<id>", types.CreateViewRequest{
Definition: types.AnalyticsViewDefinition{
Metrics: []types.Metric{},
Shape: types.ShapeTimeseries,
},
Name: "<value>",
})
if err != nil {
log.Fatal(err)
}
if res.ViewResponse != nil {
// handle response
}
}{
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"definition": {
"metrics": [
"usage_quantity"
],
"shape": "timeseries",
"compare": "previous_period",
"currency": "<string>",
"dimensions": [
"<string>"
],
"display": "chart",
"family": "usage",
"filters": [
{
"field": "<string>",
"op": "eq",
"optional": true,
"value": [
"<string>"
]
}
],
"limit": 123,
"sort": [
{
"dir": "asc",
"field": "<string>"
}
],
"time": {
"grain": "hour",
"range": "<string>"
},
"variables": [
{
"type": "date_range",
"default": [
"<string>"
],
"name": "<string>",
"required": true
}
]
},
"id": "<string>",
"name": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"version": 123
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}Analytics
Update an analytics view
Replaces the name and definition of a saved view.
PUT
/
analytics
/
views
/
{id}
cURL
curl --request PUT \
--url https://us.api.flexprice.io/v1/analytics/views/{id} \
--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
}
]
},
"name": "<string>"
}
'from flexprice import Flexprice
with Flexprice(
api_key_auth="<YOUR_API_KEY_HERE>",
) as f_client:
res = f_client.analytics.update_analytics_view(id="<id>", definition={
"metrics": [],
"shape": "timeseries",
}, name="<value>")
# 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.updateAnalyticsView("<id>", {
definition: {
metrics: [],
shape: "timeseries",
},
name: "<value>",
});
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.UpdateAnalyticsView(ctx, "<id>", types.CreateViewRequest{
Definition: types.AnalyticsViewDefinition{
Metrics: []types.Metric{},
Shape: types.ShapeTimeseries,
},
Name: "<value>",
})
if err != nil {
log.Fatal(err)
}
if res.ViewResponse != nil {
// handle response
}
}{
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"definition": {
"metrics": [
"usage_quantity"
],
"shape": "timeseries",
"compare": "previous_period",
"currency": "<string>",
"dimensions": [
"<string>"
],
"display": "chart",
"family": "usage",
"filters": [
{
"field": "<string>",
"op": "eq",
"optional": true,
"value": [
"<string>"
]
}
],
"limit": 123,
"sort": [
{
"dir": "asc",
"field": "<string>"
}
],
"time": {
"grain": "hour",
"range": "<string>"
},
"variables": [
{
"type": "date_range",
"default": [
"<string>"
],
"name": "<string>",
"required": true
}
]
},
"id": "<string>",
"name": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"version": 123
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<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>*
Path Parameters
View ID
Body
application/json
View request

